A protocol adapter contract written in Solidity enabling Anoma Resource Machine transaction settlement on EVM-compatible chains.
.
├── bindings
├── contracts
├── LICENSE
└── README.md
The contracts
folder contains the contracts written in Solidity as well
as Foundry forge tests and deploy scripts.
The bindings
folder contains bindings in Rust to
convert Rust and RISC Zero types into EVM types using the
alloy-rs
library.
If you believe you've found a security issue, we encourage you to notify us via Email at [email protected].
Please do not use the issue tracker for security issues. We welcome working with you to resolve the issue promptly.
Get an up-to-date version of Foundry with
curl -L https://foundry.paradigm.xyz | sh
foundryup
Change the directory to the contracts
folder with cd contracts
and run
forge build
To run the tests, run
forge test
To show the coverage report, run
forge coverage --ir-minimum
Append the
--no-match-coverage "(script|test|draft)"
to exclude scripts, tests, and drafts,--report lcov
to generate thelcov.info
file that can be used by code review tooling.
As a prerequisite, install the
solhint
linter (see https://github.com/protofire/solhint)slither
static analyzer (see https://github.com/crytic/slither)
To run the linter and static analyzer, run
npx solhint --config .solhint.json 'src/**/*.sol' && \
npx solhint --config .solhint.other.json 'script/**/*.sol' 'test/**/*.sol' && \
slither .
Run
forge doc
To simulate deployment on sepolia, run
forge script script/DeployProtocolAdapter.s.sol:DeployProtocolAdapter \
--sig "run(bool,address)" <IS_TEST_DEPLOYMENT> <EMERGENCY_STOP_CALLER> \
--rpc-url sepolia
Append the
--broadcast
flag to deploy on sepolia--verify --slow
flags for subsequent contract verification on Etherscan (--slow
adds 15 seconds of waiting time between verification attempts)--account <ACCOUNT_NAME>
flag to use a previously imported keystore (seecast wallet --help
for more info)
For post-deployment verification on Etherscan run
forge verify-contract \
<ADDRESS> \
src/ProtocolAdapter.sol:ProtocolAdapter \
--chain sepolia
after replacing <ADDRESS>
with the respective contract address.
The following benchmark shows the transaction execution costs without and with proof aggregation for the current protocol adapter implementation:
The current protocol adapter implementation utilizes a Merkle tree of dynamic depth starting at depth 0.
-
Get an up-to-date version of Rust with
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install RISC Zero
rzup
withcurl -L https://risczero.com/install | sh
-
Install the latest RISC Zero version with
rzup install
or a specific version (e.g.,
3.0.3
) withrzup install cargo-risczero <version>
Change the directory to the bindings
folder with cd bindings
and run
cargo build
To test the build, run
cargo test
To print a test transaction with aggregated proofs run
cargo test -- conversion::tests::generate_tx_agg --exact --show-output --ignored