-
Notifications
You must be signed in to change notification settings - Fork 124
Description
Currently, our default faucet contract is a local account with AuthRpoFalcon512Acl authentication (with distribute as the trigger procedure, and allowing anyone to call burn).
Going forward, we should deprecate this account (as it opens the door to DoS attack as described here), and instead have two types of faucets in use:
- Local faucet with the standard
AuthRpoFalcon512, with only the owner able to calldistributeandburn(used for testnet faucet) - Network faucet with note-based authentication (used for all other faucets incl. the
AggLayerFungibleFaucet
The first point is straightforward. The second needs some more work:
- Instead of calling
distributedirectly from a transaction script, network accounts operate by consuming notes addressed to them. It's the note script should calldistribute/burn(and for the latter, carry the specified asset). - The account's storage contains the
AccountIdof the owner. When adistributenote is consumed by the faucet, it first checks whetherowner == note.sender. Aburnnote doesn't perform this check, allowing anyone to sendBURNnotes.
In terms of storage, the main difference with the current faucet is that we'd store owner's AccountId rather than their public key. One nice effect of this is that the faucet no longer cares whether the owner is a single account or a multisig.
Overall, this entails:
create_basic_fungible_faucetto switch back toAuthRpoFalcon512. Should be renamed tocreate_local_fungible_faucet(and in similar fashion, renameBasicFungibleFaucet->LocalFungibleFaucet)- Create a standard
DISTRIBUTEnote - Create a standard
BURNnote - New
create_network_fungible_faucetwhich builds a network account with a newNetworkFungibleFaucetcomponent
+ we should rename distribute -> mint as it's a more standard term for token contracts.
Relevant discussion: 0xMiden/faucet#77
Open question (general)
- are authentication procedures useful for network accounts? If not, we should remove the requirement for network accounts to contain an auth procedure (more tricky because calling the auth procedure is hardcoded into the epilogue), or at least automatically insert a
NoAuthprocedure without explicitly requiringAccountBuilder::new(seed).with_auth_component(auth::NoAuth)