Expand description
Tempo configurable accounts (T14: TIP-1107, TIP-1113).
Configurations are never stored locally. They are rebuilt from the chain: the latest
ConfigurableAccountConfigUpdated or AccountUpgraded event of an account carries its full
configuration, and its commitment must match getConfigCommitment. A 1-of-1, salt-0 account
is recomputed from its owner key instead, which also covers accounts that have not sent their
first transaction yet.
cast wallet reads and updates configurations with these helpers and combines owner approvals,
including WebAuthn assertions made in a browser, into 0x05 signatures.
detect_configurable_account tells whether a sender is a configurable account, and
ConfigurableAccountSigner signs its transactions with 0x05 signatures from local owner
keys.
Re-exportsΒ§
use crate::FoundryTransactionBuilder;πuse alloy_consensus::BlockHeader;πuse alloy_network::BlockResponse;πuse alloy_network::Network;πuse alloy_network::TransactionBuilder;πuse alloy_primitives::Address;πuse alloy_primitives::B256;πuse alloy_primitives::Bytes;πuse alloy_primitives::U256;πuse alloy_primitives::hex;πuse alloy_primitives::hex;πuse alloy_provider::Provider;πuse alloy_rpc_types::BlockId;πuse alloy_rpc_types::BlockNumberOrTag;πuse alloy_rpc_types::Filter;πuse alloy_rpc_types::Log;πuse alloy_signer::Signer;πuse alloy_sol_types::SolCall;πuse alloy_sol_types::SolEvent;πuse base64::Engine;πuse base64::alphabet::URL_SAFE;πuse base64::engine::DecodePaddingMode;πuse base64::engine::GeneralPurpose;πuse base64::engine::GeneralPurposeConfig;πuse eyre::Context;πuse eyre::Result;πuse foundry_wallets::WalletSigner;πuse p256::ecdsa::signature::hazmat::PrehashSigner;πuse serde::Deserialize;πuse serde::Deserialize;πuse serde::Serialize;πuse serde::Serialize;πuse serde_json::Value;πuse std::collections::BTreeMap;πuse std::ffi::OsString;πuse std::path::Path;πuse std::path::PathBuf;πuse std::sync::Arc;πuse tempo_alloy::TempoNetwork;πuse tempo_alloy::accounts::TempoAccessKey;πuse tempo_alloy::accounts::TempoAccountsStore;πuse tempo_alloy::accounts::TempoAccountsWallet;πuse tempo_alloy::contracts::precompiles::CONFIGURABLE_ACCOUNT_ADDRESS;πuse tempo_alloy::contracts::precompiles::IConfigurableAccount;πuse tempo_alloy::contracts::precompiles::IConfigurableAccount::AccountUpgraded;πuse tempo_alloy::contracts::precompiles::IConfigurableAccount::ConfigurableAccountConfigUpdated;πuse tempo_alloy::contracts::precompiles::IConfigurableAccount::ConfigurableAccountOwner as AbiOwner;πuse tempo_alloy::rpc::ConfigurableAccountSimulationApproval;πuse tempo_alloy::rpc::ConfigurableAccountSimulationSpec;πuse tempo_alloy::rpc::PrimitiveSignatureType;πuse tempo_alloy::rpc::TempoTransactionRequest;πuse tempo_primitives::SignatureType;πuse tempo_primitives::TempoTxEnvelope;πuse tempo_primitives::transaction::ConfigurableAccountConfig;πuse tempo_primitives::transaction::ConfigurableAccountOwner;πuse tempo_primitives::transaction::ConfigurableAccountSignature;πuse tempo_primitives::transaction::KeychainSignature;πuse tempo_primitives::transaction::MAX_CONFIGURABLE_ACCOUNT_SIGNATURES;πuse tempo_primitives::transaction::PrimitiveSignature;πuse tempo_primitives::transaction::TEMPO_TX_TYPE_ID;πuse tempo_primitives::transaction::TempoSignature;πuse tempo_primitives::transaction::TempoTransaction;πuse tempo_primitives::transaction::configurable_account_digest;πuse tempo_primitives::transaction::tt_signature::P256SignatureWithPreHash;πuse tempo_primitives::transaction::tt_signature::WebAuthnSignature;π
StructsΒ§
- Config
Json - A configuration as
cast wallet owners --jsonprints it, and asforge scriptsaves it for owners on other machines. - Configurable
Account Signer - Signs the transactions of a configurable account with
0x05signatures from local owner keys, or, as an access key of another account (TIP-1111), with keychain V2 signatures that wrap them. - Linked
Account πFile - A keystoreβs linked account sidecar.
EnumsΒ§
- Configurable
Account Owner Key - A local key that approves the transactions of the configurable accounts it owns.
- Linked
Account File State - What the file at a linked account sidecar path holds.
ConstantsΒ§
- LINKED_
ACCOUNT_ SUFFIX - Suffix of the sidecar file that links a keystore to the 1-of-1, salt-0 configurable account
its key owns, next to the keystore as
<keystore>.tempo-account. - LINKED_
ACCOUNT_ πVERSION - The only linked account sidecar version this release writes and reads.
- LOG_
LOOKUP_ πWINDOW - Blocks per
eth_getLogsrequest when a configuration lookup starts. The window is halved whenever the RPC rejects a request, which covers providers that cap the block range or the number of results. - T14_
REQUIRED π - The error for a configurable account operation on a chain before T14.
FunctionsΒ§
- abi_
owners - Returns
configβs owners asIConfigurableAccountencodes them. - ca_
error - Converts a Tempo configurable account error, which is not a
std::error::Error. - check_
config π - Checks that
configis the current configuration ofaccount, whose stored commitment iscommitment. - combine_
approvals - Combines owner approvals of
innerinto a0x05signature foraccount. - config_
commitment - Returns the configuration commitment of
accountatblock, orNonewhen the configurable account precompile is not active there: before T14 a call to it returns no data. - config_
for_ πcommitment - Returns the configuration of
accountthat matches itscommitmentstored atblock. - config_
from_ πlog - Rebuilds the configuration that a configuration event announces.
- config_
from_ logs - Scans the configurable account precompileβs logs backwards from
blockfor the latest configuration event ofaccount, which must matchcommitment. - current_
config - Returns the current configuration of
account, rebuilt from the chain. - decode_
unsigned_ tx - Decodes an unsigned Tempo transaction as
cast mktx --raw-unsignedencodes it. - detect_
configurable_ account - Tells whether
accountis a configurable account atblock, and returns its configuration there. - ensure_
link_ available - Fails unless the linked account sidecar path of
keystoreis free or holds a link, whichlink_keystoremay replace. - has_
config - Tells whether
configis still the configuration ofaccountat the latest block. Fails when the commitment cannot be read, so that a failing RPC is not taken for a changed configuration. - link_
keystore - Links
keystore, whose key isowner, to the 1-of-1, salt-0 configurable account ofowner, and returns that account. Fails when the sidecar path holds another file. - linked_
account - Returns the configurable account linked to
keystoreand its owner key, orNonewhen the keystore has no link. A keystore at the sidecar path is not a link. - linked_
account_ file_ state - Returns what the file at
path, a linked account sidecar path, holds. - linked_
account_ path - Returns the path of the linked account sidecar of
keystore. - p256_
public_ key - Returns the affine coordinates of the public key of the P-256
key. - parse_
config - Parses a configuration given as JSON, or as the path of a JSON file:
salt,version,thresholdandowners(each anownerand aweight), ascast wallet owners --jsonprints it, with or without its JSON envelope. - parse_
owner_ signature - Parses an owner approval: a hex Tempo primitive signature (65-byte secp256k1,
0x01P-256 or0x02WebAuthn), a JSON signature, or a WebAuthn assertion made in a browser. A value naming an existing file is read from it. - parse_
p256_ key - Parses a hex P-256 private key.
- parse_
webauthn_ πassertion - Parses a browser WebAuthn assertion:
authenticatorData,clientDataJSONandsignature(anAuthenticatorAssertionResponse, at the top level or underresponseasPublicKeyCredential.toJSON()writes it), plus the credentialβs P-256publicKey. Binary fields are base64url or 0x-prefixed hex; the signature is DER or rawr || s. - prepare_
request - Makes
txa Tempo transaction fromaccount, whose gas estimate models the owner quorum ofspec. A0x05signature only signs Tempo (0x76) transactions. - quorum
- Returns the largest owner quorum among
owners, or the smallest one unlesslargestis set, that the node accepts: at most [MAX_CONFIGURABLE_ACCOUNT_SIGNATURES] owners that, in address order, reachthresholdonly on the last one.ownersare sorted by address. Returns an empty list when no quorum exists. - reaches_
threshold - Tells whether owners among
keyscan approve for an account withconfig, asConfigurableAccountSigner::newselects them. - sign_
p256 - Signs
digestwith the P-256keyas the0x01approval of a raw P-256 owner. The signature coversdigestitself, without the SHA-256 pre-hash of WebCrypto keys. - sign_
p256_ low_ s - Signs the prehash
messagewith the P-256keyand returns a low-s(r, s), which Tempoβs verifier requires and about half of raw ECDSA signatures are not. - simulation_
spec - Returns the owner quorum that gas estimation models for
account: the owners inapprovalswith their key types or, when it is empty, the most approvals any valid signing set can need, as maximum-sizeWebAuthnapprovals. - single_
owner_ account - Returns the account address of the 1-of-1, salt-0 configuration for
owner. - single_
owner_ config - Returns the 1-of-1, salt-0 configuration that
cast wallet newcreates forowner. - stored_
owner_ keys - Returns the locally signable keys of the Tempo Accounts store on
chain_idthat ownconfig. A missing or unreadable store has none. - unlink_
keystore - Removes the link of
keystore, and leaves any other file at its sidecar path alone. - updates_
config - Tells whether a call to
towithinputupdates the configuration of the account that sends it.