From e7a0cc1e06b85dd1b65365cdf4021dfe44ad1195 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 13:15:43 -0500 Subject: [PATCH 01/73] feat: convert tx allow list npm test to go test --- contracts/contracts/ExampleTxAllowList.sol | 20 -- contracts/scripts/deployExampleTxAllowList.ts | 16 - contracts/tasks.ts | 36 --- contracts/test/tx_allow_list.ts | 135 -------- .../allowlisttest/test_allowlist_events.go | 150 +++++++++ .../deployerallowlist/simulated_test.go | 129 +------- .../contracts/txallowlist/simulated_test.go | 296 ++++++++++++++++++ tests/precompile/genesis/tx_allow_list.json | 48 --- tests/precompile/solidity/suites.go | 8 - 9 files changed, 448 insertions(+), 390 deletions(-) delete mode 100644 contracts/contracts/ExampleTxAllowList.sol delete mode 100644 contracts/scripts/deployExampleTxAllowList.ts delete mode 100644 contracts/test/tx_allow_list.ts create mode 100644 precompile/allowlist/allowlisttest/test_allowlist_events.go create mode 100644 precompile/contracts/txallowlist/simulated_test.go delete mode 100644 tests/precompile/genesis/tx_allow_list.json diff --git a/contracts/contracts/ExampleTxAllowList.sol b/contracts/contracts/ExampleTxAllowList.sol deleted file mode 100644 index 0bc9e23da6..0000000000 --- a/contracts/contracts/ExampleTxAllowList.sol +++ /dev/null @@ -1,20 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "./AllowList.sol"; -import "./interfaces/IAllowList.sol"; - -// Precompiled Allow List Contract Address -address constant TX_ALLOW_LIST = 0x0200000000000000000000000000000000000002; - -// ExampleTxAllowList shows how TxAllowList precompile can be used in a smart contract -// All methods of [allowList] can be directly called. There are example calls as tasks in hardhat.config.ts file. -contract ExampleTxAllowList is AllowList { - constructor() AllowList(TX_ALLOW_LIST) {} - - function deployContract() public { - new Example(); - } -} - -contract Example {} diff --git a/contracts/scripts/deployExampleTxAllowList.ts b/contracts/scripts/deployExampleTxAllowList.ts deleted file mode 100644 index 8350a06941..0000000000 --- a/contracts/scripts/deployExampleTxAllowList.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ethers } from "hardhat" -import { ExampleTxAllowList } from "typechain-types" - -const main = async (): Promise => { - const contract: ExampleTxAllowList = await ethers.deployContract("ExampleTxAllowList") - - await contract.waitForDeployment() - console.log(`Contract deployed to: ${contract.target}`) -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/contracts/tasks.ts b/contracts/tasks.ts index 7964e8bed1..1db1879e68 100644 --- a/contracts/tasks.ts +++ b/contracts/tasks.ts @@ -81,42 +81,6 @@ task("deployerAllowList:revoke", "Removes the address from the list") await getRole(allowList, args.address) }) -// npx hardhat allowList:readRole --network local --address [address] -task("txAllowList:readRole", "Gets the network transaction allow list") - .addParam("address", "the address you want to know the allowlist role for") - .setAction(async (args, hre) => { - const allowList = await hre.ethers.getContractAt("IAllowList", TX_ALLOW_LIST_ADDRESS) - await getRole(allowList, args.address) - }) - -// npx hardhat allowList:addDeployer --network local --address [address] -task("txAllowList:addDeployer", "Adds an address to the transaction allow list") - .addParam("address", "the address you want to add as a deployer") - .setAction(async (args, hre) => { - const allowList = await hre.ethers.getContractAt("IAllowList", TX_ALLOW_LIST_ADDRESS) - // ADD CODE BELOW - await allowList.setEnabled(args.address) - await getRole(allowList, args.address) - }) - -// npx hardhat allowList:addAdmin --network local --address [address] -task("txAllowList:addAdmin", "Adds an admin on the transaction allow list") - .addParam("address", "the address you want to add as a admin") - .setAction(async (args, hre) => { - const allowList = await hre.ethers.getContractAt("IAllowList", TX_ALLOW_LIST_ADDRESS) - await allowList.setAdmin(args.address) - await getRole(allowList, args.address) - }) - -// npx hardhat allowList:revoke --network local --address [address] -task("txAllowList:revoke", "Removes the address from the transaction allow list") - .addParam("address", "the address you want to revoke all permission") - .setAction(async (args, hre) => { - const allowList = await hre.ethers.getContractAt("IAllowList", TX_ALLOW_LIST_ADDRESS) - await allowList.setNone(args.address) - await getRole(allowList, args.address) - }) - // npx hardhat minter:readRole --network local --address [address] task("minter:readRole", "Gets the network deployer minter list") .addParam("address", "the address you want to know the minter role for") diff --git a/contracts/test/tx_allow_list.ts b/contracts/test/tx_allow_list.ts deleted file mode 100644 index bd9e7830e4..0000000000 --- a/contracts/test/tx_allow_list.ts +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -import { ethers } from "hardhat" -import { Roles, test } from "./utils" -import { expect } from "chai"; -import { Contract, Signer } from "ethers" -import { IAllowList } from "typechain-types"; - -// make sure this is always an admin for minter precompile -const ADMIN_ADDRESS = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" -const OTHER_SIGNER = "0x0Fa8EA536Be85F32724D57A37758761B86416123" -const TX_ALLOW_LIST_ADDRESS = "0x0200000000000000000000000000000000000002" - -describe("ExampleTxAllowList", function () { - beforeEach('Setup DS-Test contract', async function () { - const signer = await ethers.getSigner(ADMIN_ADDRESS) - const allowListPromise = ethers.getContractAt("IAllowList", TX_ALLOW_LIST_ADDRESS, signer) - - return ethers.getContractFactory("ExampleTxAllowListTest", { signer }) - .then(factory => factory.deploy()) - .then(contract => { - this.testContract = contract - return Promise.all([ - contract.waitForDeployment().then(() => contract), - allowListPromise.then(allowList => allowList.setAdmin(contract.target)).then(tx => tx.wait()), - ]) - }) - .then(([contract]) => contract.setUp()) - .then(tx => tx.wait()) - }) - - test("should add contract deployer as admin", "step_contractOwnerIsAdmin") - - test("precompile should see admin address has admin role", "step_precompileHasDeployerAsAdmin") - - test("precompile should see test address has no role", "step_newAddressHasNoRole") - - test("contract should report test address has on admin role", "step_noRoleIsNotAdmin") - - test("contract should report admin address has admin role", "step_exampleAllowListReturnsTestIsAdmin") - - test("should not let test address submit txs", [ - { - method: "step_fromOther", - overrides: { from: OTHER_SIGNER }, - shouldFail: true, - }, - { - method: "step_enableOther", - overrides: { from: ADMIN_ADDRESS }, - shouldFail: false, - }, - { - method: "step_fromOther", - overrides: { from: OTHER_SIGNER }, - shouldFail: false, - }, - ]); - - test("should not allow noRole to enable itself", "step_noRoleCannotEnableItself") - - test("should allow admin to add contract as admin", "step_addContractAsAdmin") - - test("should allow admin to add allowed address as allowed through contract", "step_enableThroughContract") - - test("should let allowed address deploy", "step_canDeploy") - - test("should not let allowed add another allowed", "step_onlyAdminCanEnable") - - test("should not let allowed to revoke admin", "step_onlyAdminCanRevoke") - - test("should let admin to revoke allowed", "step_adminCanRevoke") - - test("should let manager to add allowed", "step_managerCanAllow") - - test("should let manager to revoke allowed", "step_managerCanRevoke") - - test("should not let manager to revoke admin", "step_managerCannotRevokeAdmin") - - test("should not let manager to add admin", "step_managerCannotGrantAdmin") - - test("should not let manager to add manager", "step_managerCannotGrantManager") - - test("should not let manager to revoke manager", "step_managerCannotRevokeManager") - - test("should let manager to deploy", "step_managerCanDeploy") -}) - -describe("IAllowList", function () { - let owner: Signer - let ownerAddress: string - let contract: IAllowList - before(async function () { - owner = await ethers.getSigner(ADMIN_ADDRESS); - ownerAddress = await owner.getAddress() - contract = await ethers.getContractAt("IAllowList", TX_ALLOW_LIST_ADDRESS, owner) - }); - - it("should emit event after set admin", async function () { - let testAddress = "0x0111000000000000000000000000000000000001" - let tx = await contract.setAdmin(testAddress) - let receipt = await tx.wait() - await expect(receipt) - .to.emit(contract, 'RoleSet') - .withArgs(Roles.Admin, testAddress, ownerAddress, Roles.None) - }) - - it("should emit event after set manager", async function () { - let testAddress = "0x0222000000000000000000000000000000000002" - let tx = await contract.setManager(testAddress) - let receipt = await tx.wait() - await expect(receipt) - .to.emit(contract, 'RoleSet') - .withArgs(Roles.Manager, testAddress, ownerAddress, Roles.None) - }) - - it("should emit event after set enabled", async function () { - let testAddress = "0x0333000000000000000000000000000000000003" - let tx = await contract.setEnabled(testAddress) - let receipt = await tx.wait() - await expect(receipt) - .to.emit(contract, 'RoleSet') - .withArgs(Roles.Enabled, testAddress, ownerAddress, Roles.None) - }) - - it("should emit event after set none", async function () { - let testAddress = "0x0333000000000000000000000000000000000003" - let tx = await contract.setNone(testAddress) - let receipt = await tx.wait() - await expect(receipt) - .to.emit(contract, 'RoleSet') - .withArgs(Roles.None, testAddress, ownerAddress, Roles.Enabled) - }) -}) diff --git a/precompile/allowlist/allowlisttest/test_allowlist_events.go b/precompile/allowlist/allowlisttest/test_allowlist_events.go new file mode 100644 index 0000000000..b6fad627f1 --- /dev/null +++ b/precompile/allowlist/allowlisttest/test_allowlist_events.go @@ -0,0 +1,150 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package allowlisttest + +import ( + "testing" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/crypto" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/precompile/allowlist" + "github.com/ava-labs/subnet-evm/precompile/contracts/testutils" + + sim "github.com/ava-labs/subnet-evm/ethclient/simulated" + allowlistbindings "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest/bindings" +) + +// RunAllowListEventTests runs the standard AllowList event emission tests. +// This can be used by any precompile that uses the AllowList pattern. +func RunAllowListEventTests( + t *testing.T, + newBackend func(t *testing.T) *sim.Backend, + contractAddress common.Address, + adminAuth *bind.TransactOpts, + adminAddress common.Address, +) { + t.Helper() + + testKey, _ := crypto.GenerateKey() + testAddress := crypto.PubkeyToAddress(testKey.PublicKey) + + type testCase struct { + name string + testRun func(*allowlistbindings.IAllowList, *bind.TransactOpts, *sim.Backend, *testing.T, common.Address) + expectedEvents []allowlistbindings.IAllowListRoleSet + } + + testCases := []testCase{ + { + name: "should emit event after set admin", + testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { + tx, err := allowList.SetAdmin(auth, addr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + }, + expectedEvents: []allowlistbindings.IAllowListRoleSet{ + { + Role: allowlist.AdminRole.Big(), + Account: testAddress, + Sender: adminAddress, + OldRole: allowlist.NoRole.Big(), + }, + }, + }, + { + name: "should emit event after set manager", + testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { + tx, err := allowList.SetManager(auth, addr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + }, + expectedEvents: []allowlistbindings.IAllowListRoleSet{ + { + Role: allowlist.ManagerRole.Big(), + Account: testAddress, + Sender: adminAddress, + OldRole: allowlist.NoRole.Big(), + }, + }, + }, + { + name: "should emit event after set enabled", + testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { + tx, err := allowList.SetEnabled(auth, addr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + }, + expectedEvents: []allowlistbindings.IAllowListRoleSet{ + { + Role: allowlist.EnabledRole.Big(), + Account: testAddress, + Sender: adminAddress, + OldRole: allowlist.NoRole.Big(), + }, + }, + }, + { + name: "should emit event after set none", + testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { + // First set the address to Enabled so we can test setting it to None + tx, err := allowList.SetEnabled(auth, addr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + + tx, err = allowList.SetNone(auth, addr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + }, + expectedEvents: []allowlistbindings.IAllowListRoleSet{ + { + Role: allowlist.EnabledRole.Big(), + Account: testAddress, + Sender: adminAddress, + OldRole: allowlist.NoRole.Big(), + }, + { + Role: allowlist.NoRole.Big(), + Account: testAddress, + Sender: adminAddress, + OldRole: allowlist.EnabledRole.Big(), + }, + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + require := require.New(t) + + backend := newBackend(t) + defer backend.Close() + + allowList, err := allowlistbindings.NewIAllowList(contractAddress, backend.Client()) + require.NoError(err) + + tc.testRun(allowList, adminAuth, backend, t, testAddress) + + iter, err := allowList.FilterRoleSet(nil, nil, nil, nil) + require.NoError(err) + defer iter.Close() + + // Verify event fields match expected values + for _, expectedEvent := range tc.expectedEvents { + require.True(iter.Next(), "expected to find RoleSet event") + event := iter.Event + require.Zero(expectedEvent.Role.Cmp(event.Role), "role mismatch") + require.Equal(expectedEvent.Account, event.Account, "account mismatch") + require.Equal(expectedEvent.Sender, event.Sender, "sender mismatch") + require.Zero(expectedEvent.OldRole.Cmp(event.OldRole), "oldRole mismatch") + } + + // Verify there are no more events + require.False(iter.Next(), "expected no more RoleSet events") + require.NoError(iter.Error()) + }) + } +} diff --git a/precompile/contracts/deployerallowlist/simulated_test.go b/precompile/contracts/deployerallowlist/simulated_test.go index fbc08ed87e..444aef4eca 100644 --- a/precompile/contracts/deployerallowlist/simulated_test.go +++ b/precompile/contracts/deployerallowlist/simulated_test.go @@ -217,131 +217,6 @@ func TestDeployerAllowList(t *testing.T) { } func TestIAllowList_Events(t *testing.T) { - chainID := params.TestChainConfig.ChainID - admin := testutils.NewAuth(t, adminKey, chainID) - testKey, _ := crypto.GenerateKey() - testAddress := crypto.PubkeyToAddress(testKey.PublicKey) - - type testCase struct { - name string - testRun func(*allowlistbindings.IAllowList, *bind.TransactOpts, *sim.Backend, *testing.T, common.Address) - expectedEvents []allowlistbindings.IAllowListRoleSet - } - - testCases := []testCase{ - { - name: "should emit event after set admin", - testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { - tx, err := allowList.SetAdmin(auth, addr) - require.NoError(t, err) - testutils.WaitReceipt(t, backend, tx) - }, - expectedEvents: []allowlistbindings.IAllowListRoleSet{ - { - Role: allowlist.AdminRole.Big(), - Account: testAddress, - Sender: adminAddress, - OldRole: allowlist.NoRole.Big(), - }, - }, - }, - { - name: "should emit event after set manager", - testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { - tx, err := allowList.SetManager(auth, addr) - require.NoError(t, err) - testutils.WaitReceipt(t, backend, tx) - }, - expectedEvents: []allowlistbindings.IAllowListRoleSet{ - { - Role: allowlist.ManagerRole.Big(), - Account: testAddress, - Sender: adminAddress, - OldRole: allowlist.NoRole.Big(), - }, - }, - }, - { - name: "should emit event after set enabled", - testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { - tx, err := allowList.SetEnabled(auth, addr) - require.NoError(t, err) - testutils.WaitReceipt(t, backend, tx) - }, - expectedEvents: []allowlistbindings.IAllowListRoleSet{ - { - Role: allowlist.EnabledRole.Big(), - Account: testAddress, - Sender: adminAddress, - OldRole: allowlist.NoRole.Big(), - }, - }, - }, - { - name: "should emit event after set none", - testRun: func(allowList *allowlistbindings.IAllowList, auth *bind.TransactOpts, backend *sim.Backend, t *testing.T, addr common.Address) { - // First set the address to Enabled so we can test setting it to None - tx, err := allowList.SetEnabled(auth, addr) - require.NoError(t, err) - testutils.WaitReceipt(t, backend, tx) - - tx, err = allowList.SetNone(auth, addr) - require.NoError(t, err) - testutils.WaitReceipt(t, backend, tx) - }, - expectedEvents: []allowlistbindings.IAllowListRoleSet{ - { - Role: allowlist.EnabledRole.Big(), - Account: testAddress, - Sender: adminAddress, - OldRole: allowlist.NoRole.Big(), - }, - { - Role: allowlist.NoRole.Big(), - Account: testAddress, - Sender: adminAddress, - OldRole: allowlist.EnabledRole.Big(), - }, - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - require := require.New(t) - - backend := newBackendWithDeployerAllowList(t) - defer backend.Close() - - allowList, err := allowlistbindings.NewIAllowList(deployerallowlist.ContractAddress, backend.Client()) - require.NoError(err) - - tc.testRun(allowList, admin, backend, t, testAddress) - - // Filter for RoleSet events using FilterRoleSet - // This will filter for all RoleSet events. - iter, err := allowList.FilterRoleSet( - nil, - nil, - nil, - nil, - ) - require.NoError(err) - defer iter.Close() - - // Verify event fields match expected values - for _, expectedEvent := range tc.expectedEvents { - require.True(iter.Next(), "expected to find RoleSet event") - event := iter.Event - require.Zero(expectedEvent.Role.Cmp(event.Role), "role mismatch") - require.Equal(expectedEvent.Account, event.Account, "account mismatch") - require.Equal(expectedEvent.Sender, event.Sender, "sender mismatch") - require.Zero(expectedEvent.OldRole.Cmp(event.OldRole), "oldRole mismatch") - } - - // Verify there are no more events - require.False(iter.Next(), "expected no more RoleSet events") - require.NoError(iter.Error()) - }) - } + admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) + allowlisttest.RunAllowListEventTests(t, newBackendWithDeployerAllowList, deployerallowlist.ContractAddress, admin, adminAddress) } diff --git a/precompile/contracts/txallowlist/simulated_test.go b/precompile/contracts/txallowlist/simulated_test.go new file mode 100644 index 0000000000..23ee07d8a5 --- /dev/null +++ b/precompile/contracts/txallowlist/simulated_test.go @@ -0,0 +1,296 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package txallowlist_test + +import ( + "math/big" + "testing" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core" + "github.com/ava-labs/subnet-evm/params" + "github.com/ava-labs/subnet-evm/params/extras" + "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" + "github.com/ava-labs/subnet-evm/precompile/allowlist" + "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" + "github.com/ava-labs/subnet-evm/precompile/contracts/testutils" + "github.com/ava-labs/subnet-evm/precompile/contracts/txallowlist" + "github.com/ava-labs/subnet-evm/utils" + + sim "github.com/ava-labs/subnet-evm/ethclient/simulated" + allowlistbindings "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest/bindings" +) + +var ( + adminKey, _ = crypto.GenerateKey() + unprivilegedKey, _ = crypto.GenerateKey() + + adminAddress = crypto.PubkeyToAddress(adminKey.PublicKey) + unprivilegedAddress = crypto.PubkeyToAddress(unprivilegedKey.PublicKey) +) + +func TestMain(m *testing.M) { + // Ensure libevm extras are registered for tests. + core.RegisterExtras() + customtypes.Register() + params.RegisterExtras() + m.Run() +} + +func newBackendWithTxAllowList(t *testing.T) *sim.Backend { + t.Helper() + chainCfg := params.Copy(params.TestChainConfig) + // Enable TxAllowList at genesis with admin set to adminAddress. + params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ + txallowlist.ConfigKey: txallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil), + } + return sim.NewBackend( + types.GenesisAlloc{ + adminAddress: {Balance: big.NewInt(1000000000000000000)}, + unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, + }, + sim.WithChainConfig(&chainCfg), + ) +} + +// Helper functions to reduce test boilerplate + +func deployAllowListTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *allowlistbindings.AllowListTest) { + t.Helper() + addr, tx, contract, err := allowlistbindings.DeployAllowListTest(auth, b.Client(), txallowlist.ContractAddress) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, b, tx) + return addr, contract +} + +func TestTxAllowList(t *testing.T) { + chainID := params.TestChainConfig.ChainID + admin := testutils.NewAuth(t, adminKey, chainID) + + type testCase struct { + name string + test func(t *testing.T, backend *sim.Backend, precompileIntf *allowlistbindings.IAllowList) + } + + testCases := []testCase{ + { + name: "should verify sender is admin", + test: func(t *testing.T, _ *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowlisttest.VerifyRole(t, allowList, adminAddress, allowlist.AdminRole) + }, + }, + { + name: "should verify new address has no role", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowListTestAddr, _ := deployAllowListTest(t, backend, admin) + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.NoRole) + }, + }, + { + name: "should verify contract correctly reports admin status", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowListTestAddr, allowListTest := deployAllowListTest(t, backend, admin) + + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.NoRole) + + isAdmin, err := allowListTest.IsAdmin(nil, allowListTestAddr) + require.NoError(t, err) + require.False(t, isAdmin) + + isAdmin, err = allowListTest.IsAdmin(nil, adminAddress) + require.NoError(t, err) + require.True(t, isAdmin) + }, + }, + { + name: "should allow admin to add contract as admin via precompile", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowListTestAddr, allowListTest := deployAllowListTest(t, backend, admin) + + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.NoRole) + allowlisttest.SetAsAdmin(t, backend, allowList, admin, allowListTestAddr) + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.AdminRole) + + isAdmin, err := allowListTest.IsAdmin(nil, allowListTestAddr) + require.NoError(t, err) + require.True(t, isAdmin) + }, + }, + { + name: "should allow admin to add enabled address via contract", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowListTestAddr, allowListTest := deployAllowListTest(t, backend, admin) + otherContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.NoRole) + allowlisttest.SetAsAdmin(t, backend, allowList, admin, allowListTestAddr) + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.AdminRole) + + tx, err := allowListTest.SetEnabled(admin, otherContractAddr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + + isEnabled, err := allowListTest.IsEnabled(nil, otherContractAddr) + require.NoError(t, err) + require.True(t, isEnabled) + allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.EnabledRole) + }, + }, + { + name: "should not allow enabled address to add another enabled", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowListTestAddr, allowListTest := deployAllowListTest(t, backend, admin) + otherContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsEnabled(t, backend, allowList, admin, allowListTestAddr) + allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.EnabledRole) + + // Try to set another address as enabled - should fail + _, err := allowListTest.SetEnabled(admin, otherContractAddr) + require.ErrorContains(t, err, "execution reverted") + + allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.NoRole) + }, + }, + { + name: "should allow admin to revoke enabled", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowListTestAddr, allowListTest := deployAllowListTest(t, backend, admin) + enabledContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsAdmin(t, backend, allowList, admin, allowListTestAddr) + + tx, err := allowListTest.SetEnabled(admin, enabledContractAddr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + + isEnabled, err := allowListTest.IsEnabled(nil, enabledContractAddr) + require.NoError(t, err) + require.True(t, isEnabled) + + tx, err = allowListTest.Revoke(admin, enabledContractAddr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + + allowlisttest.VerifyRole(t, allowList, enabledContractAddr, allowlist.NoRole) + }, + }, + { + name: "should allow manager to add enabled", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + managerContractAddr, managerContract := deployAllowListTest(t, backend, admin) + enabledContractAddr, _ := deployAllowListTest(t, backend, admin) + + // Set contract as manager + allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) + allowlisttest.VerifyRole(t, allowList, managerContractAddr, allowlist.ManagerRole) + + // Manager should be able to set enabled + tx, err := managerContract.SetEnabled(admin, enabledContractAddr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + + allowlisttest.VerifyRole(t, allowList, enabledContractAddr, allowlist.EnabledRole) + }, + }, + { + name: "should allow manager to revoke enabled", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + managerContractAddr, managerContract := deployAllowListTest(t, backend, admin) + enabledContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) + + allowlisttest.SetAsEnabled(t, backend, allowList, admin, enabledContractAddr) + allowlisttest.VerifyRole(t, allowList, enabledContractAddr, allowlist.EnabledRole) + + tx, err := managerContract.Revoke(admin, enabledContractAddr) + require.NoError(t, err) + testutils.WaitReceipt(t, backend, tx) + + allowlisttest.VerifyRole(t, allowList, enabledContractAddr, allowlist.NoRole) + }, + }, + { + name: "should not allow manager to revoke admin", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + managerContractAddr, managerContract := deployAllowListTest(t, backend, admin) + adminContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) + allowlisttest.SetAsAdmin(t, backend, allowList, admin, adminContractAddr) + + _, err := managerContract.Revoke(admin, adminContractAddr) + require.ErrorContains(t, err, "execution reverted") + + allowlisttest.VerifyRole(t, allowList, adminContractAddr, allowlist.AdminRole) + }, + }, + { + name: "should not allow manager to grant admin", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + managerContractAddr, managerContract := deployAllowListTest(t, backend, admin) + otherContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) + + _, err := managerContract.SetAdmin(admin, otherContractAddr) + require.ErrorContains(t, err, "execution reverted") + + allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.NoRole) + }, + }, + { + name: "should not allow manager to grant manager", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + managerContractAddr, managerContract := deployAllowListTest(t, backend, admin) + otherContractAddr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) + + _, err := managerContract.SetManager(admin, otherContractAddr) + require.ErrorContains(t, err, "execution reverted") + + allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.NoRole) + }, + }, + { + name: "should not allow manager to revoke manager", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + manager1Addr, manager1Contract := deployAllowListTest(t, backend, admin) + manager2Addr, _ := deployAllowListTest(t, backend, admin) + + allowlisttest.SetAsManager(t, backend, allowList, admin, manager1Addr) + allowlisttest.SetAsManager(t, backend, allowList, admin, manager2Addr) + + _, err := manager1Contract.Revoke(admin, manager2Addr) + require.ErrorContains(t, err, "execution reverted") + + allowlisttest.VerifyRole(t, allowList, manager2Addr, allowlist.ManagerRole) + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + backend := newBackendWithTxAllowList(t) + defer backend.Close() + + allowList, err := allowlistbindings.NewIAllowList(txallowlist.ContractAddress, backend.Client()) + require.NoError(t, err) + + tc.test(t, backend, allowList) + }) + } +} + +func TestIAllowList_Events(t *testing.T) { + admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) + allowlisttest.RunAllowListEventTests(t, newBackendWithTxAllowList, txallowlist.ContractAddress, admin, adminAddress) +} diff --git a/tests/precompile/genesis/tx_allow_list.json b/tests/precompile/genesis/tx_allow_list.json deleted file mode 100644 index a2a1aaeb18..0000000000 --- a/tests/precompile/genesis/tx_allow_list.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "config": { - "chainId": 99999, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "muirGlacierBlock": 0, - "feeConfig": { - "gasLimit": 20000000, - "minBaseFee": 1000000000, - "targetGas": 100000000, - "baseFeeChangeDenominator": 48, - "minBlockGasCost": 0, - "maxBlockGasCost": 10000000, - "targetBlockRate": 1, - "blockGasCostStep": 500000 - }, - "txAllowListConfig": { - "blockTimestamp": 0, - "adminAddresses": [ - "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" - ] - } - }, - "alloc": { - "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { - "balance": "0x52B7D2DCC80CD2E4000000" - }, - "0Fa8EA536Be85F32724D57A37758761B86416123": { - "balance": "0x52B7D2DCC80CD2E4000000" - } - }, - "nonce": "0x0", - "timestamp": "0x5FCB13D0", - "extraData": "0x00", - "gasLimit": "0x1312D00", - "difficulty": "0x0", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", - "number": "0x0", - "gasUsed": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index 63cdafedf3..d41077cfad 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -37,14 +37,6 @@ func RegisterAsyncTests() { // Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/) // to use to launch the subnet and the name of the TS test file to run on the subnet (in ./contracts/tests/) - ginkgo.It("tx allow list", ginkgo.Label("Precompile"), ginkgo.Label("TxAllowList"), func() { - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - - blockchainID := subnetsSuite.GetBlockchainID("tx_allow_list") - runDefaultHardhatTests(ctx, blockchainID, "tx_allow_list") - }) - ginkgo.It("fee manager", ginkgo.Label("Precompile"), ginkgo.Label("FeeManager"), func() { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() From 169f6f38ad988d795725c844ccaeeab3ea4e3915 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 13:21:14 -0500 Subject: [PATCH 02/73] chore: delete old example --- .../contracts/test/ExampleTxAllowListTest.sol | 303 ------------------ 1 file changed, 303 deletions(-) delete mode 100644 contracts/contracts/test/ExampleTxAllowListTest.sol diff --git a/contracts/contracts/test/ExampleTxAllowListTest.sol b/contracts/contracts/test/ExampleTxAllowListTest.sol deleted file mode 100644 index debfa9de2a..0000000000 --- a/contracts/contracts/test/ExampleTxAllowListTest.sol +++ /dev/null @@ -1,303 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "../ExampleTxAllowList.sol"; -import "../AllowList.sol"; -import "../interfaces/IAllowList.sol"; -import "./AllowListTest.sol"; - -contract ExampleTxAllowListTest is AllowListTest { - address constant OTHER_ADDRESS = 0x0Fa8EA536Be85F32724D57A37758761B86416123; - - IAllowList allowList = IAllowList(TX_ALLOW_LIST); - - function setUp() public { - allowList.setNone(OTHER_ADDRESS); - } - - function step_contractOwnerIsAdmin() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - assertTrue(example.isAdmin(address(this))); - } - - function step_precompileHasDeployerAsAdmin() public { - assertRole(allowList.readAllowList(msg.sender), AllowList.Role.Admin); - } - - function step_newAddressHasNoRole() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - assertRole(allowList.readAllowList(address(example)), AllowList.Role.None); - } - - function step_noRoleIsNotAdmin() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList other = new ExampleTxAllowList(); - assertTrue(!example.isAdmin(address(other))); - } - - function step_exampleAllowListReturnsTestIsAdmin() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - assertTrue(example.isAdmin(address(this))); - } - - function step_fromOther() public { - // used as a noop to test transaction-success or failure, depending on wether the signer has been added to the tx-allow-list - } - - function step_enableOther() public { - assertRole(allowList.readAllowList(OTHER_ADDRESS), AllowList.Role.None); - allowList.setEnabled(OTHER_ADDRESS); - } - - function step_noRoleCannotEnableItself() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - - assertRole(allowList.readAllowList(address(example)), AllowList.Role.None); - - try example.setEnabled(address(example)) { - assertTrue(false, "setEnabled should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - } - - function step_addContractAsAdmin() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - address exampleAddress = address(example); - - assertRole(allowList.readAllowList(exampleAddress), AllowList.Role.None); - - allowList.setAdmin(exampleAddress); - - assertRole(allowList.readAllowList(exampleAddress), AllowList.Role.Admin); - - assertTrue(example.isAdmin(exampleAddress)); - } - - function step_enableThroughContract() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList other = new ExampleTxAllowList(); - address exampleAddress = address(example); - address otherAddress = address(other); - - assertTrue(!example.isEnabled(exampleAddress)); - assertTrue(!example.isEnabled(otherAddress)); - - allowList.setAdmin(exampleAddress); - - assertTrue(example.isEnabled(exampleAddress)); - assertTrue(!example.isEnabled(otherAddress)); - - example.setEnabled(otherAddress); - - assertTrue(example.isEnabled(exampleAddress)); - assertTrue(example.isEnabled(otherAddress)); - } - - function step_canDeploy() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - address exampleAddress = address(example); - - allowList.setEnabled(exampleAddress); - - example.deployContract(); - } - - function step_onlyAdminCanEnable() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList other = new ExampleTxAllowList(); - address exampleAddress = address(example); - address otherAddress = address(other); - - assertTrue(!example.isEnabled(exampleAddress)); - assertTrue(!example.isEnabled(otherAddress)); - - allowList.setEnabled(exampleAddress); - - assertTrue(example.isEnabled(exampleAddress)); - assertTrue(!example.isEnabled(otherAddress)); - - try example.setEnabled(otherAddress) { - assertTrue(false, "setEnabled should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - // state should not have changed when setEnabled fails - assertTrue(!example.isEnabled(otherAddress)); - } - - function step_onlyAdminCanRevoke() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList other = new ExampleTxAllowList(); - address exampleAddress = address(example); - address otherAddress = address(other); - - assertTrue(!example.isEnabled(exampleAddress)); - assertTrue(!example.isEnabled(otherAddress)); - - allowList.setEnabled(exampleAddress); - allowList.setAdmin(otherAddress); - - assertTrue(example.isEnabled(exampleAddress) && !example.isAdmin(exampleAddress)); - assertTrue(example.isAdmin(otherAddress)); - - try example.revoke(otherAddress) { - assertTrue(false, "revoke should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - // state should not have changed when revoke fails - assertTrue(example.isAdmin(otherAddress)); - } - - function step_adminCanRevoke() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList other = new ExampleTxAllowList(); - address exampleAddress = address(example); - address otherAddress = address(other); - - assertTrue(!example.isEnabled(exampleAddress)); - assertTrue(!example.isEnabled(otherAddress)); - - allowList.setAdmin(exampleAddress); - allowList.setAdmin(otherAddress); - - assertTrue(example.isAdmin(exampleAddress)); - assertTrue(other.isAdmin(otherAddress)); - - example.revoke(otherAddress); - assertTrue(!other.isEnabled(otherAddress)); - } - - function step_managerCanAllow() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList manager = new ExampleTxAllowList(); - address exampleAddress = address(example); - address managerAddress = address(manager); - - assertTrue(!example.isEnabled(exampleAddress)); - assertTrue(!example.isManager(managerAddress)); - - allowList.setManager(managerAddress); - - assertTrue(manager.isManager(managerAddress)); - - manager.setEnabled(exampleAddress); - assertTrue(example.isEnabled(exampleAddress)); - } - - function step_managerCanRevoke() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList manager = new ExampleTxAllowList(); - address exampleAddress = address(example); - address managerAddress = address(manager); - - assertTrue(!example.isAdmin(exampleAddress)); - assertTrue(!example.isManager(managerAddress)); - - allowList.setEnabled(exampleAddress); - allowList.setManager(managerAddress); - - assertTrue(example.isEnabled(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - - manager.revoke(exampleAddress); - assertTrue(!example.isEnabled(exampleAddress)); - } - - function step_managerCannotRevokeAdmin() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList manager = new ExampleTxAllowList(); - address exampleAddress = address(example); - address managerAddress = address(manager); - - assertTrue(!example.isAdmin(exampleAddress)); - assertTrue(!example.isManager(managerAddress)); - - allowList.setAdmin(exampleAddress); - allowList.setManager(managerAddress); - - assertTrue(example.isAdmin(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - - try manager.revoke(managerAddress) { - assertTrue(false, "revoke should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - try manager.revoke(exampleAddress) { - assertTrue(false, "revoke should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - // state should not have changed when revoke fails - assertTrue(example.isAdmin(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - } - - function step_managerCannotGrantAdmin() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList manager = new ExampleTxAllowList(); - address exampleAddress = address(example); - address managerAddress = address(manager); - - assertTrue(!example.isAdmin(exampleAddress)); - assertTrue(!example.isManager(managerAddress)); - - allowList.setManager(managerAddress); - - assertTrue(manager.isManager(managerAddress)); - - try manager.setAdmin(exampleAddress) { - assertTrue(false, "setAdmin should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - // state should not have changed when setAdmin fails - assertTrue(!example.isAdmin(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - } - - function step_managerCannotGrantManager() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList manager = new ExampleTxAllowList(); - address exampleAddress = address(example); - address managerAddress = address(manager); - - allowList.setManager(managerAddress); - - assertTrue(!example.isManager(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - - try manager.setManager(exampleAddress) { - assertTrue(false, "setManager should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - // state should not have changed when setManager fails - assertTrue(!example.isManager(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - } - - function step_managerCannotRevokeManager() public { - ExampleTxAllowList example = new ExampleTxAllowList(); - ExampleTxAllowList manager = new ExampleTxAllowList(); - address exampleAddress = address(example); - address managerAddress = address(manager); - - allowList.setManager(exampleAddress); - allowList.setManager(managerAddress); - - assertTrue(example.isManager(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - - try manager.revoke(exampleAddress) { - assertTrue(false, "revoke should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - - // state should not have changed when revoke fails - assertTrue(example.isManager(exampleAddress)); - assertTrue(manager.isManager(managerAddress)); - } - - function step_managerCanDeploy() public { - ExampleTxAllowList manager = new ExampleTxAllowList(); - address managerAddress = address(manager); - - allowList.setManager(managerAddress); - - manager.deployContract(); - } -} From 60110f81b0ff7c218b6258f51c9e064026a2cb2b Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 15:19:04 -0500 Subject: [PATCH 03/73] feat: convert reward manager npm test to go test --- contracts/contracts/ExampleRewardManager.sol | 34 - .../scripts/deployExampleRewardManager.ts | 16 - contracts/test/reward_manager.ts | 85 -- .../bindings}/IRewardManager.sol | 0 .../bindings/RewardManagerTest.sol | 36 + .../rewardmanagertest/bindings/compile.go | 12 + .../bindings/gen_irewardmanager_binding.go | 1034 +++++++++++++++++ .../bindings/gen_rewardmanagertest_binding.go | 349 ++++++ .../contracts/rewardmanager/simulated_test.go | 338 ++++++ .../contracts/testutils/simulated_helpers.go | 42 + tests/precompile/genesis/reward_manager.json | 48 - tests/precompile/solidity/suites.go | 8 - 12 files changed, 1811 insertions(+), 191 deletions(-) delete mode 100644 contracts/contracts/ExampleRewardManager.sol delete mode 100644 contracts/scripts/deployExampleRewardManager.ts delete mode 100644 contracts/test/reward_manager.ts rename {contracts/contracts/interfaces => precompile/contracts/rewardmanager/rewardmanagertest/bindings}/IRewardManager.sol (100%) create mode 100644 precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol create mode 100644 precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go create mode 100644 precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_irewardmanager_binding.go create mode 100644 precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go create mode 100644 precompile/contracts/rewardmanager/simulated_test.go delete mode 100644 tests/precompile/genesis/reward_manager.json diff --git a/contracts/contracts/ExampleRewardManager.sol b/contracts/contracts/ExampleRewardManager.sol deleted file mode 100644 index 2a0d48132c..0000000000 --- a/contracts/contracts/ExampleRewardManager.sol +++ /dev/null @@ -1,34 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "./interfaces/IRewardManager.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; - -address constant REWARD_MANAGER_ADDRESS = 0x0200000000000000000000000000000000000004; - -// ExampleRewardManager is a sample wrapper contract for RewardManager precompile. -contract ExampleRewardManager is Ownable { - IRewardManager rewardManager = IRewardManager(REWARD_MANAGER_ADDRESS); - - constructor() Ownable(msg.sender) {} - - function currentRewardAddress() public view returns (address) { - return rewardManager.currentRewardAddress(); - } - - function setRewardAddress(address addr) public onlyOwner { - rewardManager.setRewardAddress(addr); - } - - function allowFeeRecipients() public onlyOwner { - rewardManager.allowFeeRecipients(); - } - - function disableRewards() public onlyOwner { - rewardManager.disableRewards(); - } - - function areFeeRecipientsAllowed() public view returns (bool) { - return rewardManager.areFeeRecipientsAllowed(); - } -} diff --git a/contracts/scripts/deployExampleRewardManager.ts b/contracts/scripts/deployExampleRewardManager.ts deleted file mode 100644 index 0a58c75460..0000000000 --- a/contracts/scripts/deployExampleRewardManager.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ethers } from "hardhat" -import { ExampleRewardManager } from "typechain-types" - -const main = async (): Promise => { - const contract: ExampleRewardManager = await ethers.deployContract("ExampleRewardManager") - - await contract.waitForDeployment() - console.log(`Contract deployed to: ${contract.target}`) -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/contracts/test/reward_manager.ts b/contracts/test/reward_manager.ts deleted file mode 100644 index f9c60133ba..0000000000 --- a/contracts/test/reward_manager.ts +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -import { ethers } from "hardhat" -import { test } from "./utils" -import { expect } from "chai"; -import { Contract, Signer } from "ethers" -import { IRewardManager } from "typechain-types"; - -// make sure this is always an admin for reward manager precompile -const ADMIN_ADDRESS = "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" -const REWARD_MANAGER_ADDRESS = "0x0200000000000000000000000000000000000004" -const BLACKHOLE_ADDRESS = "0x0100000000000000000000000000000000000000" - -describe("ExampleRewardManager", function () { - beforeEach('Setup DS-Test contract', async function () { - const signer = await ethers.getSigner(ADMIN_ADDRESS) - const rewardManagerPromise = ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS, signer) - - return ethers.getContractFactory("ExampleRewardManagerTest", signer) - .then(factory => factory.deploy()) - .then(contract => { - this.testContract = contract - return contract.waitForDeployment().then(() => contract) - }) - .then(contract => contract.setUp()) - .then(tx => Promise.all([rewardManagerPromise, tx.wait()])) - .then(([rewardManager]) => rewardManager.setAdmin(this.testContract.target)) - .then(tx => tx.wait()) - }) - - test("should send fees to blackhole", ["step_captureBlackholeBalance", "step_checkSendFeesToBlackhole"]) - - test("should not appoint reward address before enabled", "step_doesNotSetRewardAddressBeforeEnabled") - - test("contract should be added to enabled list", "step_setEnabled") - - test("should be appointed as reward address", "step_setRewardAddress") - - // we need to change the fee receiver, send a transaction for the new receiver to receive fees, then check the balance change. - // the new fee receiver won't receive fees in the same block where it was set. - test("should be able to receive fees", ["step_setupReceiveFees", "step_receiveFees", "step_checkReceiveFees"]) - - test("should return false for allowFeeRecipients check", "step_areFeeRecipientsAllowed") - - test("should enable allowFeeRecipients", "step_allowFeeRecipients") - - test("should disable reward address", "step_disableRewardAddress") -}); - -describe("IRewardManager", function () { - let owner: Signer - let ownerAddress: string - let contract: IRewardManager - before(async function () { - owner = await ethers.getSigner(ADMIN_ADDRESS); - ownerAddress = await owner.getAddress() - contract = await ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS, owner) - }); - - it("should emit reward address changed event ", async function () { - let testAddress = "0x0444400000000000000000000000000000000004" - let tx = await contract.setRewardAddress(testAddress) - let receipt = await tx.wait() - await expect(receipt) - .to.be.emit(contract, 'RewardAddressChanged') - .withArgs(ownerAddress, BLACKHOLE_ADDRESS, testAddress) - }) - - it("should emit fee recipients allowed event ", async function () { - let tx = await contract.allowFeeRecipients() - let receipt = await tx.wait() - await expect(receipt) - .to.be.emit(contract, 'FeeRecipientsAllowed') - .withArgs(ownerAddress) - }) - - it("should emit rewards disabled event ", async function () { - let tx = await contract.disableRewards() - let receipt = await tx.wait() - await expect(receipt) - .to.be.emit(contract, 'RewardsDisabled') - .withArgs(ownerAddress) - }) -}) diff --git a/contracts/contracts/interfaces/IRewardManager.sol b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol similarity index 100% rename from contracts/contracts/interfaces/IRewardManager.sol rename to precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol new file mode 100644 index 0000000000..c55c5e1e84 --- /dev/null +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol @@ -0,0 +1,36 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import "./IRewardManager.sol"; + +contract RewardManagerTest { + IRewardManager private rewardManager; + + constructor(address rewardManagerPrecompile) { + rewardManager = IRewardManager(rewardManagerPrecompile); + } + + function setRewardAddress(address addr) external { + rewardManager.setRewardAddress(addr); + } + + function allowFeeRecipients() external { + rewardManager.allowFeeRecipients(); + } + + function disableRewards() external { + rewardManager.disableRewards(); + } + + function currentRewardAddress() external view returns (address) { + return rewardManager.currentRewardAddress(); + } + + function areFeeRecipientsAllowed() external view returns (bool) { + return rewardManager.areFeeRecipientsAllowed(); + } + + // Allow contract to receive ETH for fee testing + receive() external payable {} +} + diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go new file mode 100644 index 0000000000..4658b7ac52 --- /dev/null +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go @@ -0,0 +1,12 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package bindings + +// Step 1: Compile Solidity contracts to generate ABI and bin files +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../../.. contracts/=contracts/ precompile/=precompile/ --evm-version cancun RewardManagerTest.sol IRewardManager.sol +// Step 2: Generate Go bindings from the compiled artifacts +//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IRewardManager --abi artifacts/IRewardManager.abi --bin artifacts/IRewardManager.bin --out gen_irewardmanager_binding.go +//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type RewardManagerTest --abi artifacts/RewardManagerTest.abi --bin artifacts/RewardManagerTest.bin --out gen_rewardmanagertest_binding.go +// Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_irewardmanager_binding.go gen_rewardmanagertest_binding.go && rm -f gen_irewardmanager_binding.go.bak gen_rewardmanagertest_binding.go.bak" diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_irewardmanager_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_irewardmanager_binding.go new file mode 100644 index 0000000000..5790ed8e95 --- /dev/null +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_irewardmanager_binding.go @@ -0,0 +1,1034 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ava-labs/libevm" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// IRewardManagerMetaData contains all meta data concerning the IRewardManager contract. +var IRewardManagerMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"FeeRecipientsAllowed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldRewardAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newRewardAddress\",\"type\":\"address\"}],\"name\":\"RewardAddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RewardsDisabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"role\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldRole\",\"type\":\"uint256\"}],\"name\":\"RoleSet\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isAllowed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"rewardAddress\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"readAllowList\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"role\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setNone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// IRewardManagerABI is the input ABI used to generate the binding from. +// Deprecated: Use IRewardManagerMetaData.ABI instead. +var IRewardManagerABI = IRewardManagerMetaData.ABI + +// IRewardManager is an auto generated Go binding around an Ethereum contract. +type IRewardManager struct { + IRewardManagerCaller // Read-only binding to the contract + IRewardManagerTransactor // Write-only binding to the contract + IRewardManagerFilterer // Log filterer for contract events +} + +// IRewardManagerCaller is an auto generated read-only Go binding around an Ethereum contract. +type IRewardManagerCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IRewardManagerTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IRewardManagerTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IRewardManagerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IRewardManagerFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IRewardManagerSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IRewardManagerSession struct { + Contract *IRewardManager // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IRewardManagerCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IRewardManagerCallerSession struct { + Contract *IRewardManagerCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IRewardManagerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IRewardManagerTransactorSession struct { + Contract *IRewardManagerTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IRewardManagerRaw is an auto generated low-level Go binding around an Ethereum contract. +type IRewardManagerRaw struct { + Contract *IRewardManager // Generic contract binding to access the raw methods on +} + +// IRewardManagerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IRewardManagerCallerRaw struct { + Contract *IRewardManagerCaller // Generic read-only contract binding to access the raw methods on +} + +// IRewardManagerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IRewardManagerTransactorRaw struct { + Contract *IRewardManagerTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIRewardManager creates a new instance of IRewardManager, bound to a specific deployed contract. +func NewIRewardManager(address common.Address, backend bind.ContractBackend) (*IRewardManager, error) { + contract, err := bindIRewardManager(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IRewardManager{IRewardManagerCaller: IRewardManagerCaller{contract: contract}, IRewardManagerTransactor: IRewardManagerTransactor{contract: contract}, IRewardManagerFilterer: IRewardManagerFilterer{contract: contract}}, nil +} + +// NewIRewardManagerCaller creates a new read-only instance of IRewardManager, bound to a specific deployed contract. +func NewIRewardManagerCaller(address common.Address, caller bind.ContractCaller) (*IRewardManagerCaller, error) { + contract, err := bindIRewardManager(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IRewardManagerCaller{contract: contract}, nil +} + +// NewIRewardManagerTransactor creates a new write-only instance of IRewardManager, bound to a specific deployed contract. +func NewIRewardManagerTransactor(address common.Address, transactor bind.ContractTransactor) (*IRewardManagerTransactor, error) { + contract, err := bindIRewardManager(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IRewardManagerTransactor{contract: contract}, nil +} + +// NewIRewardManagerFilterer creates a new log filterer instance of IRewardManager, bound to a specific deployed contract. +func NewIRewardManagerFilterer(address common.Address, filterer bind.ContractFilterer) (*IRewardManagerFilterer, error) { + contract, err := bindIRewardManager(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IRewardManagerFilterer{contract: contract}, nil +} + +// bindIRewardManager binds a generic wrapper to an already deployed contract. +func bindIRewardManager(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IRewardManagerMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IRewardManager *IRewardManagerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IRewardManager.Contract.IRewardManagerCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IRewardManager *IRewardManagerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IRewardManager.Contract.IRewardManagerTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IRewardManager *IRewardManagerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IRewardManager.Contract.IRewardManagerTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IRewardManager *IRewardManagerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IRewardManager.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IRewardManager *IRewardManagerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IRewardManager.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IRewardManager *IRewardManagerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IRewardManager.Contract.contract.Transact(opts, method, params...) +} + +// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. +// +// Solidity: function areFeeRecipientsAllowed() view returns(bool isAllowed) +func (_IRewardManager *IRewardManagerCaller) AreFeeRecipientsAllowed(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _IRewardManager.contract.Call(opts, &out, "areFeeRecipientsAllowed") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. +// +// Solidity: function areFeeRecipientsAllowed() view returns(bool isAllowed) +func (_IRewardManager *IRewardManagerSession) AreFeeRecipientsAllowed() (bool, error) { + return _IRewardManager.Contract.AreFeeRecipientsAllowed(&_IRewardManager.CallOpts) +} + +// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. +// +// Solidity: function areFeeRecipientsAllowed() view returns(bool isAllowed) +func (_IRewardManager *IRewardManagerCallerSession) AreFeeRecipientsAllowed() (bool, error) { + return _IRewardManager.Contract.AreFeeRecipientsAllowed(&_IRewardManager.CallOpts) +} + +// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. +// +// Solidity: function currentRewardAddress() view returns(address rewardAddress) +func (_IRewardManager *IRewardManagerCaller) CurrentRewardAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _IRewardManager.contract.Call(opts, &out, "currentRewardAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. +// +// Solidity: function currentRewardAddress() view returns(address rewardAddress) +func (_IRewardManager *IRewardManagerSession) CurrentRewardAddress() (common.Address, error) { + return _IRewardManager.Contract.CurrentRewardAddress(&_IRewardManager.CallOpts) +} + +// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. +// +// Solidity: function currentRewardAddress() view returns(address rewardAddress) +func (_IRewardManager *IRewardManagerCallerSession) CurrentRewardAddress() (common.Address, error) { + return _IRewardManager.Contract.CurrentRewardAddress(&_IRewardManager.CallOpts) +} + +// ReadAllowList is a free data retrieval call binding the contract method 0xeb54dae1. +// +// Solidity: function readAllowList(address addr) view returns(uint256 role) +func (_IRewardManager *IRewardManagerCaller) ReadAllowList(opts *bind.CallOpts, addr common.Address) (*big.Int, error) { + var out []interface{} + err := _IRewardManager.contract.Call(opts, &out, "readAllowList", addr) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ReadAllowList is a free data retrieval call binding the contract method 0xeb54dae1. +// +// Solidity: function readAllowList(address addr) view returns(uint256 role) +func (_IRewardManager *IRewardManagerSession) ReadAllowList(addr common.Address) (*big.Int, error) { + return _IRewardManager.Contract.ReadAllowList(&_IRewardManager.CallOpts, addr) +} + +// ReadAllowList is a free data retrieval call binding the contract method 0xeb54dae1. +// +// Solidity: function readAllowList(address addr) view returns(uint256 role) +func (_IRewardManager *IRewardManagerCallerSession) ReadAllowList(addr common.Address) (*big.Int, error) { + return _IRewardManager.Contract.ReadAllowList(&_IRewardManager.CallOpts, addr) +} + +// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. +// +// Solidity: function allowFeeRecipients() returns() +func (_IRewardManager *IRewardManagerTransactor) AllowFeeRecipients(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "allowFeeRecipients") +} + +// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. +// +// Solidity: function allowFeeRecipients() returns() +func (_IRewardManager *IRewardManagerSession) AllowFeeRecipients() (*types.Transaction, error) { + return _IRewardManager.Contract.AllowFeeRecipients(&_IRewardManager.TransactOpts) +} + +// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. +// +// Solidity: function allowFeeRecipients() returns() +func (_IRewardManager *IRewardManagerTransactorSession) AllowFeeRecipients() (*types.Transaction, error) { + return _IRewardManager.Contract.AllowFeeRecipients(&_IRewardManager.TransactOpts) +} + +// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. +// +// Solidity: function disableRewards() returns() +func (_IRewardManager *IRewardManagerTransactor) DisableRewards(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "disableRewards") +} + +// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. +// +// Solidity: function disableRewards() returns() +func (_IRewardManager *IRewardManagerSession) DisableRewards() (*types.Transaction, error) { + return _IRewardManager.Contract.DisableRewards(&_IRewardManager.TransactOpts) +} + +// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. +// +// Solidity: function disableRewards() returns() +func (_IRewardManager *IRewardManagerTransactorSession) DisableRewards() (*types.Transaction, error) { + return _IRewardManager.Contract.DisableRewards(&_IRewardManager.TransactOpts) +} + +// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. +// +// Solidity: function setAdmin(address addr) returns() +func (_IRewardManager *IRewardManagerTransactor) SetAdmin(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "setAdmin", addr) +} + +// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. +// +// Solidity: function setAdmin(address addr) returns() +func (_IRewardManager *IRewardManagerSession) SetAdmin(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetAdmin(&_IRewardManager.TransactOpts, addr) +} + +// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. +// +// Solidity: function setAdmin(address addr) returns() +func (_IRewardManager *IRewardManagerTransactorSession) SetAdmin(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetAdmin(&_IRewardManager.TransactOpts, addr) +} + +// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. +// +// Solidity: function setEnabled(address addr) returns() +func (_IRewardManager *IRewardManagerTransactor) SetEnabled(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "setEnabled", addr) +} + +// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. +// +// Solidity: function setEnabled(address addr) returns() +func (_IRewardManager *IRewardManagerSession) SetEnabled(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetEnabled(&_IRewardManager.TransactOpts, addr) +} + +// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. +// +// Solidity: function setEnabled(address addr) returns() +func (_IRewardManager *IRewardManagerTransactorSession) SetEnabled(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetEnabled(&_IRewardManager.TransactOpts, addr) +} + +// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. +// +// Solidity: function setManager(address addr) returns() +func (_IRewardManager *IRewardManagerTransactor) SetManager(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "setManager", addr) +} + +// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. +// +// Solidity: function setManager(address addr) returns() +func (_IRewardManager *IRewardManagerSession) SetManager(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetManager(&_IRewardManager.TransactOpts, addr) +} + +// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. +// +// Solidity: function setManager(address addr) returns() +func (_IRewardManager *IRewardManagerTransactorSession) SetManager(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetManager(&_IRewardManager.TransactOpts, addr) +} + +// SetNone is a paid mutator transaction binding the contract method 0x8c6bfb3b. +// +// Solidity: function setNone(address addr) returns() +func (_IRewardManager *IRewardManagerTransactor) SetNone(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "setNone", addr) +} + +// SetNone is a paid mutator transaction binding the contract method 0x8c6bfb3b. +// +// Solidity: function setNone(address addr) returns() +func (_IRewardManager *IRewardManagerSession) SetNone(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetNone(&_IRewardManager.TransactOpts, addr) +} + +// SetNone is a paid mutator transaction binding the contract method 0x8c6bfb3b. +// +// Solidity: function setNone(address addr) returns() +func (_IRewardManager *IRewardManagerTransactorSession) SetNone(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetNone(&_IRewardManager.TransactOpts, addr) +} + +// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. +// +// Solidity: function setRewardAddress(address addr) returns() +func (_IRewardManager *IRewardManagerTransactor) SetRewardAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _IRewardManager.contract.Transact(opts, "setRewardAddress", addr) +} + +// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. +// +// Solidity: function setRewardAddress(address addr) returns() +func (_IRewardManager *IRewardManagerSession) SetRewardAddress(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetRewardAddress(&_IRewardManager.TransactOpts, addr) +} + +// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. +// +// Solidity: function setRewardAddress(address addr) returns() +func (_IRewardManager *IRewardManagerTransactorSession) SetRewardAddress(addr common.Address) (*types.Transaction, error) { + return _IRewardManager.Contract.SetRewardAddress(&_IRewardManager.TransactOpts, addr) +} + +// IRewardManagerFeeRecipientsAllowedIterator is returned from FilterFeeRecipientsAllowed and is used to iterate over the raw logs and unpacked data for FeeRecipientsAllowed events raised by the IRewardManager contract. +type IRewardManagerFeeRecipientsAllowedIterator struct { + Event *IRewardManagerFeeRecipientsAllowed // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IRewardManagerFeeRecipientsAllowedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IRewardManagerFeeRecipientsAllowed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IRewardManagerFeeRecipientsAllowed) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IRewardManagerFeeRecipientsAllowedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IRewardManagerFeeRecipientsAllowedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IRewardManagerFeeRecipientsAllowed represents a FeeRecipientsAllowed event raised by the IRewardManager contract. +type IRewardManagerFeeRecipientsAllowed struct { + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterFeeRecipientsAllowed is a free log retrieval operation binding the contract event 0xabb1949bd129fef9b84601a48aee89d600d90074ca10216a02ce43996be55991. +// +// Solidity: event FeeRecipientsAllowed(address indexed sender) +func (_IRewardManager *IRewardManagerFilterer) FilterFeeRecipientsAllowed(opts *bind.FilterOpts, sender []common.Address) (*IRewardManagerFeeRecipientsAllowedIterator, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _IRewardManager.contract.FilterLogs(opts, "FeeRecipientsAllowed", senderRule) + if err != nil { + return nil, err + } + return &IRewardManagerFeeRecipientsAllowedIterator{contract: _IRewardManager.contract, event: "FeeRecipientsAllowed", logs: logs, sub: sub}, nil +} + +// WatchFeeRecipientsAllowed is a free log subscription operation binding the contract event 0xabb1949bd129fef9b84601a48aee89d600d90074ca10216a02ce43996be55991. +// +// Solidity: event FeeRecipientsAllowed(address indexed sender) +func (_IRewardManager *IRewardManagerFilterer) WatchFeeRecipientsAllowed(opts *bind.WatchOpts, sink chan<- *IRewardManagerFeeRecipientsAllowed, sender []common.Address) (event.Subscription, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _IRewardManager.contract.WatchLogs(opts, "FeeRecipientsAllowed", senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IRewardManagerFeeRecipientsAllowed) + if err := _IRewardManager.contract.UnpackLog(event, "FeeRecipientsAllowed", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseFeeRecipientsAllowed is a log parse operation binding the contract event 0xabb1949bd129fef9b84601a48aee89d600d90074ca10216a02ce43996be55991. +// +// Solidity: event FeeRecipientsAllowed(address indexed sender) +func (_IRewardManager *IRewardManagerFilterer) ParseFeeRecipientsAllowed(log types.Log) (*IRewardManagerFeeRecipientsAllowed, error) { + event := new(IRewardManagerFeeRecipientsAllowed) + if err := _IRewardManager.contract.UnpackLog(event, "FeeRecipientsAllowed", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IRewardManagerRewardAddressChangedIterator is returned from FilterRewardAddressChanged and is used to iterate over the raw logs and unpacked data for RewardAddressChanged events raised by the IRewardManager contract. +type IRewardManagerRewardAddressChangedIterator struct { + Event *IRewardManagerRewardAddressChanged // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IRewardManagerRewardAddressChangedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IRewardManagerRewardAddressChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IRewardManagerRewardAddressChanged) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IRewardManagerRewardAddressChangedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IRewardManagerRewardAddressChangedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IRewardManagerRewardAddressChanged represents a RewardAddressChanged event raised by the IRewardManager contract. +type IRewardManagerRewardAddressChanged struct { + Sender common.Address + OldRewardAddress common.Address + NewRewardAddress common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRewardAddressChanged is a free log retrieval operation binding the contract event 0xc2a9e07cba6f4920acaa5933bd0406949d5dbef7ee698e786ea23e8708f32a6c. +// +// Solidity: event RewardAddressChanged(address indexed sender, address indexed oldRewardAddress, address indexed newRewardAddress) +func (_IRewardManager *IRewardManagerFilterer) FilterRewardAddressChanged(opts *bind.FilterOpts, sender []common.Address, oldRewardAddress []common.Address, newRewardAddress []common.Address) (*IRewardManagerRewardAddressChangedIterator, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var oldRewardAddressRule []interface{} + for _, oldRewardAddressItem := range oldRewardAddress { + oldRewardAddressRule = append(oldRewardAddressRule, oldRewardAddressItem) + } + var newRewardAddressRule []interface{} + for _, newRewardAddressItem := range newRewardAddress { + newRewardAddressRule = append(newRewardAddressRule, newRewardAddressItem) + } + + logs, sub, err := _IRewardManager.contract.FilterLogs(opts, "RewardAddressChanged", senderRule, oldRewardAddressRule, newRewardAddressRule) + if err != nil { + return nil, err + } + return &IRewardManagerRewardAddressChangedIterator{contract: _IRewardManager.contract, event: "RewardAddressChanged", logs: logs, sub: sub}, nil +} + +// WatchRewardAddressChanged is a free log subscription operation binding the contract event 0xc2a9e07cba6f4920acaa5933bd0406949d5dbef7ee698e786ea23e8708f32a6c. +// +// Solidity: event RewardAddressChanged(address indexed sender, address indexed oldRewardAddress, address indexed newRewardAddress) +func (_IRewardManager *IRewardManagerFilterer) WatchRewardAddressChanged(opts *bind.WatchOpts, sink chan<- *IRewardManagerRewardAddressChanged, sender []common.Address, oldRewardAddress []common.Address, newRewardAddress []common.Address) (event.Subscription, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var oldRewardAddressRule []interface{} + for _, oldRewardAddressItem := range oldRewardAddress { + oldRewardAddressRule = append(oldRewardAddressRule, oldRewardAddressItem) + } + var newRewardAddressRule []interface{} + for _, newRewardAddressItem := range newRewardAddress { + newRewardAddressRule = append(newRewardAddressRule, newRewardAddressItem) + } + + logs, sub, err := _IRewardManager.contract.WatchLogs(opts, "RewardAddressChanged", senderRule, oldRewardAddressRule, newRewardAddressRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IRewardManagerRewardAddressChanged) + if err := _IRewardManager.contract.UnpackLog(event, "RewardAddressChanged", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRewardAddressChanged is a log parse operation binding the contract event 0xc2a9e07cba6f4920acaa5933bd0406949d5dbef7ee698e786ea23e8708f32a6c. +// +// Solidity: event RewardAddressChanged(address indexed sender, address indexed oldRewardAddress, address indexed newRewardAddress) +func (_IRewardManager *IRewardManagerFilterer) ParseRewardAddressChanged(log types.Log) (*IRewardManagerRewardAddressChanged, error) { + event := new(IRewardManagerRewardAddressChanged) + if err := _IRewardManager.contract.UnpackLog(event, "RewardAddressChanged", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IRewardManagerRewardsDisabledIterator is returned from FilterRewardsDisabled and is used to iterate over the raw logs and unpacked data for RewardsDisabled events raised by the IRewardManager contract. +type IRewardManagerRewardsDisabledIterator struct { + Event *IRewardManagerRewardsDisabled // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IRewardManagerRewardsDisabledIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IRewardManagerRewardsDisabled) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IRewardManagerRewardsDisabled) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IRewardManagerRewardsDisabledIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IRewardManagerRewardsDisabledIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IRewardManagerRewardsDisabled represents a RewardsDisabled event raised by the IRewardManager contract. +type IRewardManagerRewardsDisabled struct { + Sender common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRewardsDisabled is a free log retrieval operation binding the contract event 0xeb121f0335efe8f4b8ebef7793c18c171834696989656a8c345acc558359fabf. +// +// Solidity: event RewardsDisabled(address indexed sender) +func (_IRewardManager *IRewardManagerFilterer) FilterRewardsDisabled(opts *bind.FilterOpts, sender []common.Address) (*IRewardManagerRewardsDisabledIterator, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _IRewardManager.contract.FilterLogs(opts, "RewardsDisabled", senderRule) + if err != nil { + return nil, err + } + return &IRewardManagerRewardsDisabledIterator{contract: _IRewardManager.contract, event: "RewardsDisabled", logs: logs, sub: sub}, nil +} + +// WatchRewardsDisabled is a free log subscription operation binding the contract event 0xeb121f0335efe8f4b8ebef7793c18c171834696989656a8c345acc558359fabf. +// +// Solidity: event RewardsDisabled(address indexed sender) +func (_IRewardManager *IRewardManagerFilterer) WatchRewardsDisabled(opts *bind.WatchOpts, sink chan<- *IRewardManagerRewardsDisabled, sender []common.Address) (event.Subscription, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _IRewardManager.contract.WatchLogs(opts, "RewardsDisabled", senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IRewardManagerRewardsDisabled) + if err := _IRewardManager.contract.UnpackLog(event, "RewardsDisabled", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRewardsDisabled is a log parse operation binding the contract event 0xeb121f0335efe8f4b8ebef7793c18c171834696989656a8c345acc558359fabf. +// +// Solidity: event RewardsDisabled(address indexed sender) +func (_IRewardManager *IRewardManagerFilterer) ParseRewardsDisabled(log types.Log) (*IRewardManagerRewardsDisabled, error) { + event := new(IRewardManagerRewardsDisabled) + if err := _IRewardManager.contract.UnpackLog(event, "RewardsDisabled", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IRewardManagerRoleSetIterator is returned from FilterRoleSet and is used to iterate over the raw logs and unpacked data for RoleSet events raised by the IRewardManager contract. +type IRewardManagerRoleSetIterator struct { + Event *IRewardManagerRoleSet // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IRewardManagerRoleSetIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IRewardManagerRoleSet) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IRewardManagerRoleSet) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IRewardManagerRoleSetIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IRewardManagerRoleSetIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IRewardManagerRoleSet represents a RoleSet event raised by the IRewardManager contract. +type IRewardManagerRoleSet struct { + Role *big.Int + Account common.Address + Sender common.Address + OldRole *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterRoleSet is a free log retrieval operation binding the contract event 0xcdb7ea01f00a414d78757bdb0f6391664ba3fedf987eed280927c1e7d695be3e. +// +// Solidity: event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole) +func (_IRewardManager *IRewardManagerFilterer) FilterRoleSet(opts *bind.FilterOpts, role []*big.Int, account []common.Address, sender []common.Address) (*IRewardManagerRoleSetIterator, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _IRewardManager.contract.FilterLogs(opts, "RoleSet", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return &IRewardManagerRoleSetIterator{contract: _IRewardManager.contract, event: "RoleSet", logs: logs, sub: sub}, nil +} + +// WatchRoleSet is a free log subscription operation binding the contract event 0xcdb7ea01f00a414d78757bdb0f6391664ba3fedf987eed280927c1e7d695be3e. +// +// Solidity: event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole) +func (_IRewardManager *IRewardManagerFilterer) WatchRoleSet(opts *bind.WatchOpts, sink chan<- *IRewardManagerRoleSet, role []*big.Int, account []common.Address, sender []common.Address) (event.Subscription, error) { + + var roleRule []interface{} + for _, roleItem := range role { + roleRule = append(roleRule, roleItem) + } + var accountRule []interface{} + for _, accountItem := range account { + accountRule = append(accountRule, accountItem) + } + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + + logs, sub, err := _IRewardManager.contract.WatchLogs(opts, "RoleSet", roleRule, accountRule, senderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IRewardManagerRoleSet) + if err := _IRewardManager.contract.UnpackLog(event, "RoleSet", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseRoleSet is a log parse operation binding the contract event 0xcdb7ea01f00a414d78757bdb0f6391664ba3fedf987eed280927c1e7d695be3e. +// +// Solidity: event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole) +func (_IRewardManager *IRewardManagerFilterer) ParseRoleSet(log types.Log) (*IRewardManagerRoleSet, error) { + event := new(IRewardManagerRoleSet) + if err := _IRewardManager.contract.UnpackLog(event, "RoleSet", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go new file mode 100644 index 0000000000..734068cb00 --- /dev/null +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -0,0 +1,349 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ava-labs/libevm" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. +var RewardManagerTestMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea26469706673582212203c681ed5976eae17a33bf0795d671642b2e725abda45c61d05839f7f2fa7c53c64736f6c634300081e0033", +} + +// RewardManagerTestABI is the input ABI used to generate the binding from. +// Deprecated: Use RewardManagerTestMetaData.ABI instead. +var RewardManagerTestABI = RewardManagerTestMetaData.ABI + +// RewardManagerTestBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use RewardManagerTestMetaData.Bin instead. +var RewardManagerTestBin = RewardManagerTestMetaData.Bin + +// DeployRewardManagerTest deploys a new Ethereum contract, binding an instance of RewardManagerTest to it. +func DeployRewardManagerTest(auth *bind.TransactOpts, backend bind.ContractBackend, rewardManagerPrecompile common.Address) (common.Address, *types.Transaction, *RewardManagerTest, error) { + parsed, err := RewardManagerTestMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(RewardManagerTestBin), backend, rewardManagerPrecompile) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &RewardManagerTest{RewardManagerTestCaller: RewardManagerTestCaller{contract: contract}, RewardManagerTestTransactor: RewardManagerTestTransactor{contract: contract}, RewardManagerTestFilterer: RewardManagerTestFilterer{contract: contract}}, nil +} + +// RewardManagerTest is an auto generated Go binding around an Ethereum contract. +type RewardManagerTest struct { + RewardManagerTestCaller // Read-only binding to the contract + RewardManagerTestTransactor // Write-only binding to the contract + RewardManagerTestFilterer // Log filterer for contract events +} + +// RewardManagerTestCaller is an auto generated read-only Go binding around an Ethereum contract. +type RewardManagerTestCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RewardManagerTestTransactor is an auto generated write-only Go binding around an Ethereum contract. +type RewardManagerTestTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RewardManagerTestFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type RewardManagerTestFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// RewardManagerTestSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type RewardManagerTestSession struct { + Contract *RewardManagerTest // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// RewardManagerTestCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type RewardManagerTestCallerSession struct { + Contract *RewardManagerTestCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// RewardManagerTestTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type RewardManagerTestTransactorSession struct { + Contract *RewardManagerTestTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// RewardManagerTestRaw is an auto generated low-level Go binding around an Ethereum contract. +type RewardManagerTestRaw struct { + Contract *RewardManagerTest // Generic contract binding to access the raw methods on +} + +// RewardManagerTestCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type RewardManagerTestCallerRaw struct { + Contract *RewardManagerTestCaller // Generic read-only contract binding to access the raw methods on +} + +// RewardManagerTestTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type RewardManagerTestTransactorRaw struct { + Contract *RewardManagerTestTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewRewardManagerTest creates a new instance of RewardManagerTest, bound to a specific deployed contract. +func NewRewardManagerTest(address common.Address, backend bind.ContractBackend) (*RewardManagerTest, error) { + contract, err := bindRewardManagerTest(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &RewardManagerTest{RewardManagerTestCaller: RewardManagerTestCaller{contract: contract}, RewardManagerTestTransactor: RewardManagerTestTransactor{contract: contract}, RewardManagerTestFilterer: RewardManagerTestFilterer{contract: contract}}, nil +} + +// NewRewardManagerTestCaller creates a new read-only instance of RewardManagerTest, bound to a specific deployed contract. +func NewRewardManagerTestCaller(address common.Address, caller bind.ContractCaller) (*RewardManagerTestCaller, error) { + contract, err := bindRewardManagerTest(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &RewardManagerTestCaller{contract: contract}, nil +} + +// NewRewardManagerTestTransactor creates a new write-only instance of RewardManagerTest, bound to a specific deployed contract. +func NewRewardManagerTestTransactor(address common.Address, transactor bind.ContractTransactor) (*RewardManagerTestTransactor, error) { + contract, err := bindRewardManagerTest(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &RewardManagerTestTransactor{contract: contract}, nil +} + +// NewRewardManagerTestFilterer creates a new log filterer instance of RewardManagerTest, bound to a specific deployed contract. +func NewRewardManagerTestFilterer(address common.Address, filterer bind.ContractFilterer) (*RewardManagerTestFilterer, error) { + contract, err := bindRewardManagerTest(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &RewardManagerTestFilterer{contract: contract}, nil +} + +// bindRewardManagerTest binds a generic wrapper to an already deployed contract. +func bindRewardManagerTest(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := RewardManagerTestMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_RewardManagerTest *RewardManagerTestRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _RewardManagerTest.Contract.RewardManagerTestCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_RewardManagerTest *RewardManagerTestRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RewardManagerTest.Contract.RewardManagerTestTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_RewardManagerTest *RewardManagerTestRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _RewardManagerTest.Contract.RewardManagerTestTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_RewardManagerTest *RewardManagerTestCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _RewardManagerTest.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_RewardManagerTest *RewardManagerTestTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RewardManagerTest.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_RewardManagerTest *RewardManagerTestTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _RewardManagerTest.Contract.contract.Transact(opts, method, params...) +} + +// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. +// +// Solidity: function areFeeRecipientsAllowed() view returns(bool) +func (_RewardManagerTest *RewardManagerTestCaller) AreFeeRecipientsAllowed(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _RewardManagerTest.contract.Call(opts, &out, "areFeeRecipientsAllowed") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. +// +// Solidity: function areFeeRecipientsAllowed() view returns(bool) +func (_RewardManagerTest *RewardManagerTestSession) AreFeeRecipientsAllowed() (bool, error) { + return _RewardManagerTest.Contract.AreFeeRecipientsAllowed(&_RewardManagerTest.CallOpts) +} + +// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. +// +// Solidity: function areFeeRecipientsAllowed() view returns(bool) +func (_RewardManagerTest *RewardManagerTestCallerSession) AreFeeRecipientsAllowed() (bool, error) { + return _RewardManagerTest.Contract.AreFeeRecipientsAllowed(&_RewardManagerTest.CallOpts) +} + +// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. +// +// Solidity: function currentRewardAddress() view returns(address) +func (_RewardManagerTest *RewardManagerTestCaller) CurrentRewardAddress(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _RewardManagerTest.contract.Call(opts, &out, "currentRewardAddress") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. +// +// Solidity: function currentRewardAddress() view returns(address) +func (_RewardManagerTest *RewardManagerTestSession) CurrentRewardAddress() (common.Address, error) { + return _RewardManagerTest.Contract.CurrentRewardAddress(&_RewardManagerTest.CallOpts) +} + +// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. +// +// Solidity: function currentRewardAddress() view returns(address) +func (_RewardManagerTest *RewardManagerTestCallerSession) CurrentRewardAddress() (common.Address, error) { + return _RewardManagerTest.Contract.CurrentRewardAddress(&_RewardManagerTest.CallOpts) +} + +// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. +// +// Solidity: function allowFeeRecipients() returns() +func (_RewardManagerTest *RewardManagerTestTransactor) AllowFeeRecipients(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RewardManagerTest.contract.Transact(opts, "allowFeeRecipients") +} + +// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. +// +// Solidity: function allowFeeRecipients() returns() +func (_RewardManagerTest *RewardManagerTestSession) AllowFeeRecipients() (*types.Transaction, error) { + return _RewardManagerTest.Contract.AllowFeeRecipients(&_RewardManagerTest.TransactOpts) +} + +// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. +// +// Solidity: function allowFeeRecipients() returns() +func (_RewardManagerTest *RewardManagerTestTransactorSession) AllowFeeRecipients() (*types.Transaction, error) { + return _RewardManagerTest.Contract.AllowFeeRecipients(&_RewardManagerTest.TransactOpts) +} + +// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. +// +// Solidity: function disableRewards() returns() +func (_RewardManagerTest *RewardManagerTestTransactor) DisableRewards(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RewardManagerTest.contract.Transact(opts, "disableRewards") +} + +// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. +// +// Solidity: function disableRewards() returns() +func (_RewardManagerTest *RewardManagerTestSession) DisableRewards() (*types.Transaction, error) { + return _RewardManagerTest.Contract.DisableRewards(&_RewardManagerTest.TransactOpts) +} + +// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. +// +// Solidity: function disableRewards() returns() +func (_RewardManagerTest *RewardManagerTestTransactorSession) DisableRewards() (*types.Transaction, error) { + return _RewardManagerTest.Contract.DisableRewards(&_RewardManagerTest.TransactOpts) +} + +// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. +// +// Solidity: function setRewardAddress(address addr) returns() +func (_RewardManagerTest *RewardManagerTestTransactor) SetRewardAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _RewardManagerTest.contract.Transact(opts, "setRewardAddress", addr) +} + +// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. +// +// Solidity: function setRewardAddress(address addr) returns() +func (_RewardManagerTest *RewardManagerTestSession) SetRewardAddress(addr common.Address) (*types.Transaction, error) { + return _RewardManagerTest.Contract.SetRewardAddress(&_RewardManagerTest.TransactOpts, addr) +} + +// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. +// +// Solidity: function setRewardAddress(address addr) returns() +func (_RewardManagerTest *RewardManagerTestTransactorSession) SetRewardAddress(addr common.Address) (*types.Transaction, error) { + return _RewardManagerTest.Contract.SetRewardAddress(&_RewardManagerTest.TransactOpts, addr) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_RewardManagerTest *RewardManagerTestTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { + return _RewardManagerTest.contract.RawTransact(opts, nil) // calldata is disallowed for receive function +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_RewardManagerTest *RewardManagerTestSession) Receive() (*types.Transaction, error) { + return _RewardManagerTest.Contract.Receive(&_RewardManagerTest.TransactOpts) +} + +// Receive is a paid mutator transaction binding the contract receive function. +// +// Solidity: receive() payable returns() +func (_RewardManagerTest *RewardManagerTestTransactorSession) Receive() (*types.Transaction, error) { + return _RewardManagerTest.Contract.Receive(&_RewardManagerTest.TransactOpts) +} diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go new file mode 100644 index 0000000000..5b14cdc15c --- /dev/null +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -0,0 +1,338 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package rewardmanager_test + +import ( + "context" + "math/big" + "testing" + + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" + "github.com/stretchr/testify/require" + + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/constants" + "github.com/ava-labs/subnet-evm/core" + "github.com/ava-labs/subnet-evm/params" + "github.com/ava-labs/subnet-evm/params/extras" + "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" + "github.com/ava-labs/subnet-evm/precompile/allowlist" + "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" + "github.com/ava-labs/subnet-evm/precompile/contracts/rewardmanager" + "github.com/ava-labs/subnet-evm/precompile/contracts/testutils" + "github.com/ava-labs/subnet-evm/utils" + + sim "github.com/ava-labs/subnet-evm/ethclient/simulated" + rewardmanagerbindings "github.com/ava-labs/subnet-evm/precompile/contracts/rewardmanager/rewardmanagertest/bindings" +) + +var ( + adminKey, _ = crypto.GenerateKey() + unprivilegedKey, _ = crypto.GenerateKey() + + adminAddress = crypto.PubkeyToAddress(adminKey.PublicKey) + unprivilegedAddress = crypto.PubkeyToAddress(unprivilegedKey.PublicKey) +) + +func TestMain(m *testing.M) { + // Ensure libevm extras are registered for tests. + core.RegisterExtras() + customtypes.Register() + params.RegisterExtras() + m.Run() +} + +func newBackendWithRewardManager(t *testing.T) *sim.Backend { + t.Helper() + chainCfg := params.Copy(params.TestChainConfig) + // Enable RewardManager at genesis with admin set to adminAddress. + params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ + rewardmanager.ConfigKey: rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), + } + return sim.NewBackend( + types.GenesisAlloc{ + adminAddress: {Balance: big.NewInt(1000000000000000000)}, + unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, + }, + sim.WithChainConfig(&chainCfg), + ) +} + +// Helper functions + +func deployRewardManagerTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *rewardmanagerbindings.RewardManagerTest) { + t.Helper() + addr, tx, contract, err := rewardmanagerbindings.DeployRewardManagerTest(auth, b.Client(), rewardmanager.ContractAddress) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, b, tx) + return addr, contract +} + +func TestRewardManager(t *testing.T) { + chainID := params.TestChainConfig.ChainID + admin := testutils.NewAuth(t, adminKey, chainID) + + type testCase struct { + name string + test func(t *testing.T, backend *sim.Backend, rewardManagerIntf *rewardmanagerbindings.IRewardManager) + } + + testCases := []testCase{ + { + name: "should verify sender is admin", + test: func(t *testing.T, _ *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + allowlisttest.VerifyRole(t, rewardManager, adminAddress, allowlist.AdminRole) + }, + }, + { + name: "should verify new address has no role", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, _ := deployRewardManagerTest(t, backend, admin) + allowlisttest.VerifyRole(t, rewardManager, testContractAddr, allowlist.NoRole) + }, + }, + { + name: "should not allow non-enabled to set reward address", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + + allowlisttest.VerifyRole(t, rewardManager, testContractAddr, allowlist.NoRole) + + _, err := testContract.SetRewardAddress(admin, testContractAddr) + require.ErrorContains(t, err, "execution reverted") + }, + }, + { + name: "should allow admin to enable contract", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, _ := deployRewardManagerTest(t, backend, admin) + + allowlisttest.VerifyRole(t, rewardManager, testContractAddr, allowlist.NoRole) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + allowlisttest.VerifyRole(t, rewardManager, testContractAddr, allowlist.EnabledRole) + }, + }, + { + name: "should allow enabled contract to set reward address", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + tx, err := testContract.SetRewardAddress(admin, testContractAddr) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + currentAddr, err := testContract.CurrentRewardAddress(nil) + require.NoError(t, err) + require.Equal(t, testContractAddr, currentAddr) + }, + }, + { + name: "should return false for areFeeRecipientsAllowed by default", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + isAllowed, err := testContract.AreFeeRecipientsAllowed(nil) + require.NoError(t, err) + require.False(t, isAllowed) + }, + }, + { + name: "should allow enabled contract to allow fee recipients", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + tx, err := testContract.AllowFeeRecipients(admin) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + isAllowed, err := testContract.AreFeeRecipientsAllowed(nil) + require.NoError(t, err) + require.True(t, isAllowed) + }, + }, + { + name: "should allow enabled contract to disable rewards", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + tx, err := testContract.SetRewardAddress(admin, testContractAddr) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + currentAddr, err := testContract.CurrentRewardAddress(nil) + require.NoError(t, err) + require.Equal(t, testContractAddr, currentAddr) + + tx, err = testContract.DisableRewards(admin) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + currentAddr, err = testContract.CurrentRewardAddress(nil) + require.NoError(t, err) + require.Equal(t, constants.BlackholeAddr, currentAddr) + }, + }, + { + name: "should return blackhole as default reward address", + test: func(t *testing.T, _ *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + currentAddr, err := rewardManager.CurrentRewardAddress(nil) + require.NoError(t, err) + require.Equal(t, constants.BlackholeAddr, currentAddr) + }, + }, + { + name: "fees should go to blackhole by default", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + ctx := context.Background() + client := backend.Client() + + initialBlackholeBalance, err := client.BalanceAt(ctx, constants.BlackholeAddr, nil) + require.NoError(t, err) + + tx := testutils.SendSimpleTx(t, backend, adminKey) + testutils.WaitReceiptSuccessful(t, backend, tx) + + newBlackholeBalance, err := client.BalanceAt(ctx, constants.BlackholeAddr, nil) + require.NoError(t, err) + + require.Greater(t, newBlackholeBalance.Cmp(initialBlackholeBalance), 0, + "blackhole balance should have increased from fees") + }}, + { + name: "fees should go to configured reward address", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + ctx := context.Background() + client := backend.Client() + + rewardRecipientAddr, _ := deployRewardManagerTest(t, backend, admin) + + initialRecipientBalance, err := client.BalanceAt(ctx, rewardRecipientAddr, nil) + require.NoError(t, err) + + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, rewardRecipientAddr) + + tx, err := rewardManager.SetRewardAddress(admin, rewardRecipientAddr) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + currentAddr, err := rewardManager.CurrentRewardAddress(nil) + require.NoError(t, err) + require.Equal(t, rewardRecipientAddr, currentAddr) + + // Send a transaction to generate fees + // The fees from THIS transaction should go to the reward address + tx = testutils.SendSimpleTx(t, backend, adminKey) + testutils.WaitReceiptSuccessful(t, backend, tx) + + newRecipientBalance, err := client.BalanceAt(ctx, rewardRecipientAddr, nil) + require.NoError(t, err) + + require.Greater(t, newRecipientBalance.Cmp(initialRecipientBalance), 0, + "reward recipient balance should have increased from fees") + }}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + backend := newBackendWithRewardManager(t) + defer backend.Close() + + rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) + require.NoError(t, err) + + tc.test(t, backend, rewardManager) + }) + } +} + +func TestIRewardManager_Events(t *testing.T) { + chainID := params.TestChainConfig.ChainID + admin := testutils.NewAuth(t, adminKey, chainID) + testKey, _ := crypto.GenerateKey() + testAddress := crypto.PubkeyToAddress(testKey.PublicKey) + + t.Run("should emit RewardAddressChanged event", func(t *testing.T) { + backend := newBackendWithRewardManager(t) + defer backend.Close() + + rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) + require.NoError(t, err) + + tx, err := rewardManager.SetRewardAddress(admin, testAddress) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + iter, err := rewardManager.FilterRewardAddressChanged(nil, nil, nil, nil) + require.NoError(t, err) + defer iter.Close() + + require.True(t, iter.Next(), "expected to find RewardAddressChanged event") + event := iter.Event + require.Equal(t, adminAddress, event.Sender, "sender mismatch") + require.Equal(t, constants.BlackholeAddr, event.OldRewardAddress, "old reward address mismatch") + require.Equal(t, testAddress, event.NewRewardAddress, "new reward address mismatch") + + require.False(t, iter.Next(), "expected no more events") + require.NoError(t, iter.Error()) + }) + + t.Run("should emit FeeRecipientsAllowed event", func(t *testing.T) { + backend := newBackendWithRewardManager(t) + defer backend.Close() + + rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) + require.NoError(t, err) + + tx, err := rewardManager.AllowFeeRecipients(admin) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + iter, err := rewardManager.FilterFeeRecipientsAllowed(nil, nil) + require.NoError(t, err) + defer iter.Close() + + require.True(t, iter.Next(), "expected to find FeeRecipientsAllowed event") + event := iter.Event + require.Equal(t, adminAddress, event.Sender, "sender mismatch") + + require.False(t, iter.Next(), "expected no more events") + require.NoError(t, iter.Error()) + }) + + t.Run("should emit RewardsDisabled event", func(t *testing.T) { + backend := newBackendWithRewardManager(t) + defer backend.Close() + + rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) + require.NoError(t, err) + + tx, err := rewardManager.DisableRewards(admin) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) + + iter, err := rewardManager.FilterRewardsDisabled(nil, nil) + require.NoError(t, err) + defer iter.Close() + + require.True(t, iter.Next(), "expected to find RewardsDisabled event") + event := iter.Event + require.Equal(t, adminAddress, event.Sender, "sender mismatch") + + require.False(t, iter.Next(), "expected no more events") + require.NoError(t, iter.Error()) + }) +} + +// TODO(jonathanoppenheimer): uncomment this once RunAllowListEventTests() is merged into main +// func TestIAllowList_Events(t *testing.T) { +// admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) +// allowlisttest.RunAllowListEventTests(t, newBackendWithRewardManager, rewardmanager.ContractAddress, admin, adminAddress) +// } diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 739a4b4134..5bb1127b94 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -4,14 +4,17 @@ package testutils import ( + "context" "crypto/ecdsa" "math/big" "testing" "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/params" sim "github.com/ava-labs/subnet-evm/ethclient/simulated" ) @@ -40,3 +43,42 @@ func WaitReceiptSuccessful(t *testing.T, b *sim.Backend, tx *types.Transaction) require.Equal(t, types.ReceiptStatusSuccessful, receipt.Status, "transaction should succeed") return receipt } + +// SendSimpleTx sends a simple ETH transfer transaction +// See ethclient/simulated/backend_test.go newTx() for the source of this code +// TODO(jonathanoppenheimer): after libevmifiying the geth code, investigate whether we can use the same code for both +func SendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Transaction { + t.Helper() + ctx := context.Background() + client := b.Client() + addr := crypto.PubkeyToAddress(key.PublicKey) + + chainID, err := client.ChainID(ctx) + require.NoError(t, err) + + nonce, err := client.NonceAt(ctx, addr, nil) + require.NoError(t, err) + + head, err := client.HeaderByNumber(ctx, nil) + require.NoError(t, err) + + gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei)) + + tx := types.NewTx(&types.DynamicFeeTx{ + ChainID: chainID, + Nonce: nonce, + GasTipCap: big.NewInt(params.GWei), + GasFeeCap: gasPrice, + Gas: 21000, + To: &addr, + Value: big.NewInt(0), + }) + + signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(chainID), key) + require.NoError(t, err) + + err = client.SendTransaction(ctx, signedTx) + require.NoError(t, err) + + return signedTx +} diff --git a/tests/precompile/genesis/reward_manager.json b/tests/precompile/genesis/reward_manager.json deleted file mode 100644 index ac6c314b06..0000000000 --- a/tests/precompile/genesis/reward_manager.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "config": { - "chainId": 99999, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "muirGlacierBlock": 0, - "feeConfig": { - "gasLimit": 20000000, - "minBaseFee": 1000000000, - "targetGas": 100000000, - "baseFeeChangeDenominator": 48, - "minBlockGasCost": 0, - "maxBlockGasCost": 10000000, - "targetBlockRate": 1, - "blockGasCostStep": 500000 - }, - "rewardManagerConfig": { - "blockTimestamp": 0, - "adminAddresses": [ - "0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC" - ] - } - }, - "alloc": { - "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { - "balance": "0x52B7D2DCC80CD2E4000000" - }, - "0x0Fa8EA536Be85F32724D57A37758761B86416123": { - "balance": "0x52B7D2DCC80CD2E4000000" - } - }, - "nonce": "0x0", - "timestamp": "0x5FCB13D0", - "extraData": "0x00", - "gasLimit": "0x1312D00", - "difficulty": "0x0", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", - "number": "0x0", - "gasUsed": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index 7c38d04a5d..28cd20e34c 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -45,14 +45,6 @@ func RegisterAsyncTests() { runDefaultHardhatTests(ctx, blockchainID, "tx_allow_list") }) - ginkgo.It("reward manager", ginkgo.Label("Precompile"), ginkgo.Label("RewardManager"), func() { - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - - blockchainID := subnetsSuite.GetBlockchainID("reward_manager") - runDefaultHardhatTests(ctx, blockchainID, "reward_manager") - }) - // ADD YOUR PRECOMPILE HERE /* ginkgo.It("your precompile", ginkgo.Label("Precompile"), ginkgo.Label("YourPrecompile"), func() { From b057b886841492a17c4919ecba6c0530d9311cb5 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 15:23:00 -0500 Subject: [PATCH 04/73] fix: contract formatting and import --- .../allowlisttest/bindings/IAllowList.sol | 27 +++--- .../bindings/FeeManagerTest.sol | 94 +++++++++---------- .../feemanagertest/bindings/IFeeManager.sol | 83 ++++++++-------- .../bindings/IRewardManager.sol | 45 ++++----- .../bindings/RewardManagerTest.sol | 1 - 5 files changed, 132 insertions(+), 118 deletions(-) diff --git a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol index 8b525b12e1..80d2f2e6e8 100644 --- a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol +++ b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol @@ -2,20 +2,25 @@ pragma solidity ^0.8.24; interface IAllowList { - event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole); + event RoleSet( + uint256 indexed role, + address indexed account, + address indexed sender, + uint256 oldRole + ); - // Set [addr] to have the admin role over the precompile contract. - function setAdmin(address addr) external; + // Set [addr] to have the admin role over the precompile contract. + function setAdmin(address addr) external; - // Set [addr] to be enabled on the precompile contract. - function setEnabled(address addr) external; + // Set [addr] to be enabled on the precompile contract. + function setEnabled(address addr) external; - // Set [addr] to have the manager role over the precompile contract. - function setManager(address addr) external; + // Set [addr] to have the manager role over the precompile contract. + function setManager(address addr) external; - // Set [addr] to have no role for the precompile contract. - function setNone(address addr) external; + // Set [addr] to have no role for the precompile contract. + function setNone(address addr) external; - // Read the status of [addr]. - function readAllowList(address addr) external view returns (uint256 role); + // Read the status os [addr]. + function readAllowList(address addr) external view returns (uint256 role); } diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol b/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol index f252b0f9fc..913d955001 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol +++ b/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol @@ -4,55 +4,55 @@ pragma solidity ^0.8.24; import "./IFeeManager.sol"; contract FeeManagerTest { - IFeeManager private feeManager; + IFeeManager private feeManager; - constructor(address feeManagerPrecompile) { - feeManager = IFeeManager(feeManagerPrecompile); - } + constructor(address feeManagerPrecompile) { + feeManager = IFeeManager(feeManagerPrecompile); + } - // Calls the setFeeConfig function on the precompile - function setFeeConfig( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) external { - feeManager.setFeeConfig( - gasLimit, - targetBlockRate, - minBaseFee, - targetGas, - baseFeeChangeDenominator, - minBlockGasCost, - maxBlockGasCost, - blockGasCostStep - ); - } + // Calls the setFeeConfig function on the precompile + function setFeeConfig( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) external { + feeManager.setFeeConfig( + gasLimit, + targetBlockRate, + minBaseFee, + targetGas, + baseFeeChangeDenominator, + minBlockGasCost, + maxBlockGasCost, + blockGasCostStep + ); + } - // Calls the getFeeConfig function on the precompile - function getFeeConfig() - external - view - returns ( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) - { - return feeManager.getFeeConfig(); - } + // Calls the getFeeConfig function on the precompile + function getFeeConfig() + external + view + returns ( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) + { + return feeManager.getFeeConfig(); + } - // Calls the getFeeConfigLastChangedAt function on the precompile - function getFeeConfigLastChangedAt() external view returns (uint256) { - return feeManager.getFeeConfigLastChangedAt(); - } + // Calls the getFeeConfigLastChangedAt function on the precompile + function getFeeConfigLastChangedAt() external view returns (uint256) { + return feeManager.getFeeConfigLastChangedAt(); + } } diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol b/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol index a49234e326..21b475edf0 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol +++ b/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol @@ -3,45 +3,52 @@ pragma solidity ^0.8.24; import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; interface IFeeManager is IAllowList { - struct FeeConfig { - uint256 gasLimit; - uint256 targetBlockRate; - uint256 minBaseFee; - uint256 targetGas; - uint256 baseFeeChangeDenominator; - uint256 minBlockGasCost; - uint256 maxBlockGasCost; - uint256 blockGasCostStep; - } - event FeeConfigChanged(address indexed sender, FeeConfig oldFeeConfig, FeeConfig newFeeConfig); + struct FeeConfig { + uint256 gasLimit; + uint256 targetBlockRate; + uint256 minBaseFee; + uint256 targetGas; + uint256 baseFeeChangeDenominator; + uint256 minBlockGasCost; + uint256 maxBlockGasCost; + uint256 blockGasCostStep; + } + event FeeConfigChanged( + address indexed sender, + FeeConfig oldFeeConfig, + FeeConfig newFeeConfig + ); - // Set fee config fields to contract storage - function setFeeConfig( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) external; + // Set fee config fields to contract storage + function setFeeConfig( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) external; - // Get fee config from the contract storage - function getFeeConfig() - external - view - returns ( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ); + // Get fee config from the contract storage + function getFeeConfig() + external + view + returns ( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ); - // Get the last block number changed the fee config from the contract storage - function getFeeConfigLastChangedAt() external view returns (uint256 blockNumber); + // Get the last block number changed the fee config from the contract storage + function getFeeConfigLastChangedAt() + external + view + returns (uint256 blockNumber); } diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol index f6876e532b..bf0b484562 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol @@ -1,33 +1,36 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "./IAllowList.sol"; +import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; interface IRewardManager is IAllowList { - // RewardAddressChanged is the event logged whenever reward address is modified - event RewardAddressChanged( - address indexed sender, - address indexed oldRewardAddress, - address indexed newRewardAddress - ); + // RewardAddressChanged is the event logged whenever reward address is modified + event RewardAddressChanged( + address indexed sender, + address indexed oldRewardAddress, + address indexed newRewardAddress + ); - // FeeRecipientsAllowed is the event logged whenever fee recipient is modified - event FeeRecipientsAllowed(address indexed sender); + // FeeRecipientsAllowed is the event logged whenever fee recipient is modified + event FeeRecipientsAllowed(address indexed sender); - // RewardsDisabled is the event logged whenever rewards are disabled - event RewardsDisabled(address indexed sender); + // RewardsDisabled is the event logged whenever rewards are disabled + event RewardsDisabled(address indexed sender); - // setRewardAddress sets the reward address to the given address - function setRewardAddress(address addr) external; + // setRewardAddress sets the reward address to the given address + function setRewardAddress(address addr) external; - // allowFeeRecipients allows block builders to claim fees - function allowFeeRecipients() external; + // allowFeeRecipients allows block builders to claim fees + function allowFeeRecipients() external; - // disableRewards disables block rewards and starts burning fees - function disableRewards() external; + // disableRewards disables block rewards and starts burning fees + function disableRewards() external; - // currentRewardAddress returns the current reward address - function currentRewardAddress() external view returns (address rewardAddress); + // currentRewardAddress returns the current reward address + function currentRewardAddress() + external + view + returns (address rewardAddress); - // areFeeRecipientsAllowed returns true if fee recipients are allowed - function areFeeRecipientsAllowed() external view returns (bool isAllowed); + // areFeeRecipientsAllowed returns true if fee recipients are allowed + function areFeeRecipientsAllowed() external view returns (bool isAllowed); } diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol index c55c5e1e84..33dd1ab8cd 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol @@ -33,4 +33,3 @@ contract RewardManagerTest { // Allow contract to receive ETH for fee testing receive() external payable {} } - From a98b243a334ee45ccbe8b5748bbdc9194d7cff04 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 15:25:25 -0500 Subject: [PATCH 05/73] chore: delete old binding --- .../bindings/gen_examplerewardmanager.go | 554 ------------------ 1 file changed, 554 deletions(-) delete mode 100644 contracts/bindings/gen_examplerewardmanager.go diff --git a/contracts/bindings/gen_examplerewardmanager.go b/contracts/bindings/gen_examplerewardmanager.go deleted file mode 100644 index c35152e63b..0000000000 --- a/contracts/bindings/gen_examplerewardmanager.go +++ /dev/null @@ -1,554 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package bindings - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ava-labs/libevm" - "github.com/ava-labs/libevm/accounts/abi" - "github.com/ava-labs/libevm/accounts/abi/bind" - "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" - "github.com/ava-labs/libevm/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// ExampleRewardManagerMetaData contains all meta data concerning the ExampleRewardManager contract. -var ExampleRewardManagerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405273020000000000000000000000000000000000000460015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550348015610063575f5ffd5b50335f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100d5575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100cc91906101ea565b60405180910390fd5b6100e4816100ea60201b60201c565b50610203565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101d4826101ab565b9050919050565b6101e4816101ca565b82525050565b5f6020820190506101fd5f8301846101db565b92915050565b6107bb806102105f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c8063bc17862811610059578063bc178628146100d8578063e915608b146100e2578063f2fde38b14610100578063f6542b2e1461011c57610086565b80630329099f1461008a5780635e00e67914610094578063715018a6146100b05780638da5cb5b146100ba575b5f5ffd5b61009261013a565b005b6100ae60048036038101906100a9919061066b565b6101c0565b005b6100b8610252565b005b6100c2610265565b6040516100cf91906106a5565b60405180910390f35b6100e061028c565b005b6100ea610312565b6040516100f791906106a5565b60405180910390f35b61011a6004803603810190610115919061066b565b6103a6565b005b61012461042a565b60405161013191906106d8565b60405180910390f35b6101426104be565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156101a8575f5ffd5b505af11580156101ba573d5f5f3e3d5ffd5b50505050565b6101c86104be565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b815260040161022291906106a5565b5f604051808303815f87803b158015610239575f5ffd5b505af115801561024b573d5f5f3e3d5ffd5b5050505050565b61025a6104be565b6102635f610545565b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6102946104be565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156102fa575f5ffd5b505af115801561030c573d5f5f3e3d5ffd5b50505050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561037d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a19190610705565b905090565b6103ae6104be565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361041e575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161041591906106a5565b60405180910390fd5b61042781610545565b50565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610495573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104b9919061075a565b905090565b6104c6610606565b73ffffffffffffffffffffffffffffffffffffffff166104e4610265565b73ffffffffffffffffffffffffffffffffffffffff161461054357610507610606565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161053a91906106a5565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61063a82610611565b9050919050565b61064a81610630565b8114610654575f5ffd5b50565b5f8135905061066581610641565b92915050565b5f602082840312156106805761067f61060d565b5b5f61068d84828501610657565b91505092915050565b61069f81610630565b82525050565b5f6020820190506106b85f830184610696565b92915050565b5f8115159050919050565b6106d2816106be565b82525050565b5f6020820190506106eb5f8301846106c9565b92915050565b5f815190506106ff81610641565b92915050565b5f6020828403121561071a5761071961060d565b5b5f610727848285016106f1565b91505092915050565b610739816106be565b8114610743575f5ffd5b50565b5f8151905061075481610730565b92915050565b5f6020828403121561076f5761076e61060d565b5b5f61077c84828501610746565b9150509291505056fea2646970667358221220f61773f415e121a56de4f02b984aa72fbdd2d94a3071a4718f845950cd2a511864736f6c634300081e0033", -} - -// ExampleRewardManagerABI is the input ABI used to generate the binding from. -// Deprecated: Use ExampleRewardManagerMetaData.ABI instead. -var ExampleRewardManagerABI = ExampleRewardManagerMetaData.ABI - -// ExampleRewardManagerBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use ExampleRewardManagerMetaData.Bin instead. -var ExampleRewardManagerBin = ExampleRewardManagerMetaData.Bin - -// DeployExampleRewardManager deploys a new Ethereum contract, binding an instance of ExampleRewardManager to it. -func DeployExampleRewardManager(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ExampleRewardManager, error) { - parsed, err := ExampleRewardManagerMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ExampleRewardManagerBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &ExampleRewardManager{ExampleRewardManagerCaller: ExampleRewardManagerCaller{contract: contract}, ExampleRewardManagerTransactor: ExampleRewardManagerTransactor{contract: contract}, ExampleRewardManagerFilterer: ExampleRewardManagerFilterer{contract: contract}}, nil -} - -// ExampleRewardManager is an auto generated Go binding around an Ethereum contract. -type ExampleRewardManager struct { - ExampleRewardManagerCaller // Read-only binding to the contract - ExampleRewardManagerTransactor // Write-only binding to the contract - ExampleRewardManagerFilterer // Log filterer for contract events -} - -// ExampleRewardManagerCaller is an auto generated read-only Go binding around an Ethereum contract. -type ExampleRewardManagerCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleRewardManagerTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ExampleRewardManagerTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleRewardManagerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ExampleRewardManagerFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleRewardManagerSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ExampleRewardManagerSession struct { - Contract *ExampleRewardManager // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ExampleRewardManagerCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ExampleRewardManagerCallerSession struct { - Contract *ExampleRewardManagerCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ExampleRewardManagerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ExampleRewardManagerTransactorSession struct { - Contract *ExampleRewardManagerTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ExampleRewardManagerRaw is an auto generated low-level Go binding around an Ethereum contract. -type ExampleRewardManagerRaw struct { - Contract *ExampleRewardManager // Generic contract binding to access the raw methods on -} - -// ExampleRewardManagerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ExampleRewardManagerCallerRaw struct { - Contract *ExampleRewardManagerCaller // Generic read-only contract binding to access the raw methods on -} - -// ExampleRewardManagerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ExampleRewardManagerTransactorRaw struct { - Contract *ExampleRewardManagerTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewExampleRewardManager creates a new instance of ExampleRewardManager, bound to a specific deployed contract. -func NewExampleRewardManager(address common.Address, backend bind.ContractBackend) (*ExampleRewardManager, error) { - contract, err := bindExampleRewardManager(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ExampleRewardManager{ExampleRewardManagerCaller: ExampleRewardManagerCaller{contract: contract}, ExampleRewardManagerTransactor: ExampleRewardManagerTransactor{contract: contract}, ExampleRewardManagerFilterer: ExampleRewardManagerFilterer{contract: contract}}, nil -} - -// NewExampleRewardManagerCaller creates a new read-only instance of ExampleRewardManager, bound to a specific deployed contract. -func NewExampleRewardManagerCaller(address common.Address, caller bind.ContractCaller) (*ExampleRewardManagerCaller, error) { - contract, err := bindExampleRewardManager(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ExampleRewardManagerCaller{contract: contract}, nil -} - -// NewExampleRewardManagerTransactor creates a new write-only instance of ExampleRewardManager, bound to a specific deployed contract. -func NewExampleRewardManagerTransactor(address common.Address, transactor bind.ContractTransactor) (*ExampleRewardManagerTransactor, error) { - contract, err := bindExampleRewardManager(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ExampleRewardManagerTransactor{contract: contract}, nil -} - -// NewExampleRewardManagerFilterer creates a new log filterer instance of ExampleRewardManager, bound to a specific deployed contract. -func NewExampleRewardManagerFilterer(address common.Address, filterer bind.ContractFilterer) (*ExampleRewardManagerFilterer, error) { - contract, err := bindExampleRewardManager(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ExampleRewardManagerFilterer{contract: contract}, nil -} - -// bindExampleRewardManager binds a generic wrapper to an already deployed contract. -func bindExampleRewardManager(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ExampleRewardManagerMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ExampleRewardManager *ExampleRewardManagerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ExampleRewardManager.Contract.ExampleRewardManagerCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ExampleRewardManager *ExampleRewardManagerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.ExampleRewardManagerTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ExampleRewardManager *ExampleRewardManagerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.ExampleRewardManagerTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ExampleRewardManager *ExampleRewardManagerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ExampleRewardManager.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ExampleRewardManager *ExampleRewardManagerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ExampleRewardManager *ExampleRewardManagerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.contract.Transact(opts, method, params...) -} - -// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. -// -// Solidity: function areFeeRecipientsAllowed() view returns(bool) -func (_ExampleRewardManager *ExampleRewardManagerCaller) AreFeeRecipientsAllowed(opts *bind.CallOpts) (bool, error) { - var out []interface{} - err := _ExampleRewardManager.contract.Call(opts, &out, "areFeeRecipientsAllowed") - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. -// -// Solidity: function areFeeRecipientsAllowed() view returns(bool) -func (_ExampleRewardManager *ExampleRewardManagerSession) AreFeeRecipientsAllowed() (bool, error) { - return _ExampleRewardManager.Contract.AreFeeRecipientsAllowed(&_ExampleRewardManager.CallOpts) -} - -// AreFeeRecipientsAllowed is a free data retrieval call binding the contract method 0xf6542b2e. -// -// Solidity: function areFeeRecipientsAllowed() view returns(bool) -func (_ExampleRewardManager *ExampleRewardManagerCallerSession) AreFeeRecipientsAllowed() (bool, error) { - return _ExampleRewardManager.Contract.AreFeeRecipientsAllowed(&_ExampleRewardManager.CallOpts) -} - -// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. -// -// Solidity: function currentRewardAddress() view returns(address) -func (_ExampleRewardManager *ExampleRewardManagerCaller) CurrentRewardAddress(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ExampleRewardManager.contract.Call(opts, &out, "currentRewardAddress") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. -// -// Solidity: function currentRewardAddress() view returns(address) -func (_ExampleRewardManager *ExampleRewardManagerSession) CurrentRewardAddress() (common.Address, error) { - return _ExampleRewardManager.Contract.CurrentRewardAddress(&_ExampleRewardManager.CallOpts) -} - -// CurrentRewardAddress is a free data retrieval call binding the contract method 0xe915608b. -// -// Solidity: function currentRewardAddress() view returns(address) -func (_ExampleRewardManager *ExampleRewardManagerCallerSession) CurrentRewardAddress() (common.Address, error) { - return _ExampleRewardManager.Contract.CurrentRewardAddress(&_ExampleRewardManager.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ExampleRewardManager *ExampleRewardManagerCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ExampleRewardManager.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ExampleRewardManager *ExampleRewardManagerSession) Owner() (common.Address, error) { - return _ExampleRewardManager.Contract.Owner(&_ExampleRewardManager.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ExampleRewardManager *ExampleRewardManagerCallerSession) Owner() (common.Address, error) { - return _ExampleRewardManager.Contract.Owner(&_ExampleRewardManager.CallOpts) -} - -// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. -// -// Solidity: function allowFeeRecipients() returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactor) AllowFeeRecipients(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleRewardManager.contract.Transact(opts, "allowFeeRecipients") -} - -// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. -// -// Solidity: function allowFeeRecipients() returns() -func (_ExampleRewardManager *ExampleRewardManagerSession) AllowFeeRecipients() (*types.Transaction, error) { - return _ExampleRewardManager.Contract.AllowFeeRecipients(&_ExampleRewardManager.TransactOpts) -} - -// AllowFeeRecipients is a paid mutator transaction binding the contract method 0x0329099f. -// -// Solidity: function allowFeeRecipients() returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactorSession) AllowFeeRecipients() (*types.Transaction, error) { - return _ExampleRewardManager.Contract.AllowFeeRecipients(&_ExampleRewardManager.TransactOpts) -} - -// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. -// -// Solidity: function disableRewards() returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactor) DisableRewards(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleRewardManager.contract.Transact(opts, "disableRewards") -} - -// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. -// -// Solidity: function disableRewards() returns() -func (_ExampleRewardManager *ExampleRewardManagerSession) DisableRewards() (*types.Transaction, error) { - return _ExampleRewardManager.Contract.DisableRewards(&_ExampleRewardManager.TransactOpts) -} - -// DisableRewards is a paid mutator transaction binding the contract method 0xbc178628. -// -// Solidity: function disableRewards() returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactorSession) DisableRewards() (*types.Transaction, error) { - return _ExampleRewardManager.Contract.DisableRewards(&_ExampleRewardManager.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleRewardManager.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ExampleRewardManager *ExampleRewardManagerSession) RenounceOwnership() (*types.Transaction, error) { - return _ExampleRewardManager.Contract.RenounceOwnership(&_ExampleRewardManager.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ExampleRewardManager.Contract.RenounceOwnership(&_ExampleRewardManager.TransactOpts) -} - -// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. -// -// Solidity: function setRewardAddress(address addr) returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactor) SetRewardAddress(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ExampleRewardManager.contract.Transact(opts, "setRewardAddress", addr) -} - -// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. -// -// Solidity: function setRewardAddress(address addr) returns() -func (_ExampleRewardManager *ExampleRewardManagerSession) SetRewardAddress(addr common.Address) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.SetRewardAddress(&_ExampleRewardManager.TransactOpts, addr) -} - -// SetRewardAddress is a paid mutator transaction binding the contract method 0x5e00e679. -// -// Solidity: function setRewardAddress(address addr) returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactorSession) SetRewardAddress(addr common.Address) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.SetRewardAddress(&_ExampleRewardManager.TransactOpts, addr) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ExampleRewardManager.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ExampleRewardManager *ExampleRewardManagerSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.TransferOwnership(&_ExampleRewardManager.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ExampleRewardManager *ExampleRewardManagerTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ExampleRewardManager.Contract.TransferOwnership(&_ExampleRewardManager.TransactOpts, newOwner) -} - -// ExampleRewardManagerOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ExampleRewardManager contract. -type ExampleRewardManagerOwnershipTransferredIterator struct { - Event *ExampleRewardManagerOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ExampleRewardManagerOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ExampleRewardManagerOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ExampleRewardManagerOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ExampleRewardManagerOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ExampleRewardManagerOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ExampleRewardManagerOwnershipTransferred represents a OwnershipTransferred event raised by the ExampleRewardManager contract. -type ExampleRewardManagerOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ExampleRewardManager *ExampleRewardManagerFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ExampleRewardManagerOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ExampleRewardManager.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &ExampleRewardManagerOwnershipTransferredIterator{contract: _ExampleRewardManager.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ExampleRewardManager *ExampleRewardManagerFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ExampleRewardManagerOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ExampleRewardManager.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ExampleRewardManagerOwnershipTransferred) - if err := _ExampleRewardManager.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ExampleRewardManager *ExampleRewardManagerFilterer) ParseOwnershipTransferred(log types.Log) (*ExampleRewardManagerOwnershipTransferred, error) { - event := new(ExampleRewardManagerOwnershipTransferred) - if err := _ExampleRewardManager.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} From fb29afb6a30f874dabf220dab7f01d405e81167e Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 15:29:24 -0500 Subject: [PATCH 06/73] chore: delete example contract --- .../test/ExampleRewardManagerTest.sol | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 contracts/contracts/test/ExampleRewardManagerTest.sol diff --git a/contracts/contracts/test/ExampleRewardManagerTest.sol b/contracts/contracts/test/ExampleRewardManagerTest.sol deleted file mode 100644 index b476e1a07c..0000000000 --- a/contracts/contracts/test/ExampleRewardManagerTest.sol +++ /dev/null @@ -1,108 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "../ExampleRewardManager.sol"; -import "../interfaces/IRewardManager.sol"; -import "./AllowListTest.sol"; - -address constant BLACKHOLE_ADDRESS = 0x0100000000000000000000000000000000000000; - -contract ExampleRewardManagerTest is AllowListTest { - IRewardManager rewardManager = IRewardManager(REWARD_MANAGER_ADDRESS); - - ExampleRewardManager exampleReceiveFees; - uint exampleBalance; - - uint blackholeBalance; - - function setUp() public { - blackholeBalance = BLACKHOLE_ADDRESS.balance; - } - - function step_captureBlackholeBalance() public { - blackholeBalance = BLACKHOLE_ADDRESS.balance; - } - - function step_checkSendFeesToBlackhole() public { - assertGt(BLACKHOLE_ADDRESS.balance, blackholeBalance); - } - - function step_doesNotSetRewardAddressBeforeEnabled() public { - ExampleRewardManager example = new ExampleRewardManager(); - address exampleAddress = address(example); - - assertRole(rewardManager.readAllowList(exampleAddress), AllowList.Role.None); - - try example.setRewardAddress(exampleAddress) { - assertTrue(false, "setRewardAddress should fail"); - } catch {} // TODO should match on an error to make sure that this is failing in the way that's expected - } - - function step_setEnabled() public { - ExampleRewardManager example = new ExampleRewardManager(); - address exampleAddress = address(example); - - assertRole(rewardManager.readAllowList(exampleAddress), AllowList.Role.None); - rewardManager.setEnabled(exampleAddress); - assertRole(rewardManager.readAllowList(exampleAddress), AllowList.Role.Enabled); - } - - function step_setRewardAddress() public { - ExampleRewardManager example = new ExampleRewardManager(); - address exampleAddress = address(example); - - rewardManager.setEnabled(exampleAddress); - example.setRewardAddress(exampleAddress); - - assertEq(example.currentRewardAddress(), exampleAddress); - } - - function step_setupReceiveFees() public { - ExampleRewardManager example = new ExampleRewardManager(); - address exampleAddress = address(example); - - rewardManager.setEnabled(exampleAddress); - example.setRewardAddress(exampleAddress); - - exampleReceiveFees = example; - exampleBalance = exampleAddress.balance; - } - - function step_receiveFees() public { - // used as a noop to test if the correct address receives fees - } - - function step_checkReceiveFees() public { - assertGt(address(exampleReceiveFees).balance, exampleBalance); - } - - function step_areFeeRecipientsAllowed() public { - ExampleRewardManager example = new ExampleRewardManager(); - assertTrue(!example.areFeeRecipientsAllowed()); - } - - function step_allowFeeRecipients() public { - ExampleRewardManager example = new ExampleRewardManager(); - address exampleAddress = address(example); - - rewardManager.setEnabled(exampleAddress); - - example.allowFeeRecipients(); - assertTrue(example.areFeeRecipientsAllowed()); - } - - function step_disableRewardAddress() public { - ExampleRewardManager example = new ExampleRewardManager(); - address exampleAddress = address(example); - - rewardManager.setEnabled(exampleAddress); - - example.setRewardAddress(exampleAddress); - - assertEq(example.currentRewardAddress(), exampleAddress); - - example.disableRewards(); - - assertEq(example.currentRewardAddress(), BLACKHOLE_ADDRESS); - } -} From 4eef5e64ef1a741d4b0e2d51aeaf7b5550fb7216 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 3 Dec 2025 15:45:15 -0500 Subject: [PATCH 07/73] chore: lint --- .../contracts/rewardmanager/simulated_test.go | 26 +++++++++---------- .../contracts/testutils/simulated_helpers.go | 10 +++---- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 5b14cdc15c..d26bc9dd51 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -4,7 +4,6 @@ package rewardmanager_test import ( - "context" "math/big" "testing" @@ -190,31 +189,30 @@ func TestRewardManager(t *testing.T) { }, { name: "fees should go to blackhole by default", - test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { - ctx := context.Background() + test: func(t *testing.T, backend *sim.Backend, _ *rewardmanagerbindings.IRewardManager) { client := backend.Client() - initialBlackholeBalance, err := client.BalanceAt(ctx, constants.BlackholeAddr, nil) + initialBlackholeBalance, err := client.BalanceAt(t.Context(), constants.BlackholeAddr, nil) require.NoError(t, err) tx := testutils.SendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) - newBlackholeBalance, err := client.BalanceAt(ctx, constants.BlackholeAddr, nil) + newBlackholeBalance, err := client.BalanceAt(t.Context(), constants.BlackholeAddr, nil) require.NoError(t, err) - require.Greater(t, newBlackholeBalance.Cmp(initialBlackholeBalance), 0, + require.Positive(t, newBlackholeBalance.Cmp(initialBlackholeBalance), "blackhole balance should have increased from fees") - }}, + }, + }, { name: "fees should go to configured reward address", test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { - ctx := context.Background() client := backend.Client() rewardRecipientAddr, _ := deployRewardManagerTest(t, backend, admin) - initialRecipientBalance, err := client.BalanceAt(ctx, rewardRecipientAddr, nil) + initialRecipientBalance, err := client.BalanceAt(t.Context(), rewardRecipientAddr, nil) require.NoError(t, err) allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, rewardRecipientAddr) @@ -227,17 +225,17 @@ func TestRewardManager(t *testing.T) { require.NoError(t, err) require.Equal(t, rewardRecipientAddr, currentAddr) - // Send a transaction to generate fees - // The fees from THIS transaction should go to the reward address + // The fees from this transaction should go to the reward address tx = testutils.SendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) - newRecipientBalance, err := client.BalanceAt(ctx, rewardRecipientAddr, nil) + newRecipientBalance, err := client.BalanceAt(t.Context(), rewardRecipientAddr, nil) require.NoError(t, err) - require.Greater(t, newRecipientBalance.Cmp(initialRecipientBalance), 0, + require.Positive(t, newRecipientBalance.Cmp(initialRecipientBalance), "reward recipient balance should have increased from fees") - }}, + }, + }, } for _, tc := range testCases { diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 5bb1127b94..9a9a0014e1 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -4,7 +4,6 @@ package testutils import ( - "context" "crypto/ecdsa" "math/big" "testing" @@ -49,17 +48,16 @@ func WaitReceiptSuccessful(t *testing.T, b *sim.Backend, tx *types.Transaction) // TODO(jonathanoppenheimer): after libevmifiying the geth code, investigate whether we can use the same code for both func SendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Transaction { t.Helper() - ctx := context.Background() client := b.Client() addr := crypto.PubkeyToAddress(key.PublicKey) - chainID, err := client.ChainID(ctx) + chainID, err := client.ChainID(t.Context()) require.NoError(t, err) - nonce, err := client.NonceAt(ctx, addr, nil) + nonce, err := client.NonceAt(t.Context(), addr, nil) require.NoError(t, err) - head, err := client.HeaderByNumber(ctx, nil) + head, err := client.HeaderByNumber(t.Context(), nil) require.NoError(t, err) gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei)) @@ -77,7 +75,7 @@ func SendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Tr signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(chainID), key) require.NoError(t, err) - err = client.SendTransaction(ctx, signedTx) + err = client.SendTransaction(t.Context(), signedTx) require.NoError(t, err) return signedTx From bb219313614640b9e5d878d351e67465b9b8b169 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 11:59:11 -0500 Subject: [PATCH 08/73] test: add should not let non-enabled address submit txs --- .../allowlisttest/test_allowlist_events.go | 11 +++++------ .../contracts/deployerallowlist/simulated_test.go | 2 +- precompile/contracts/txallowlist/simulated_test.go | 13 ++++++++++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/precompile/allowlist/allowlisttest/test_allowlist_events.go b/precompile/allowlist/allowlisttest/test_allowlist_events.go index b6fad627f1..07cb4b7d58 100644 --- a/precompile/allowlist/allowlisttest/test_allowlist_events.go +++ b/precompile/allowlist/allowlisttest/test_allowlist_events.go @@ -25,7 +25,6 @@ func RunAllowListEventTests( newBackend func(t *testing.T) *sim.Backend, contractAddress common.Address, adminAuth *bind.TransactOpts, - adminAddress common.Address, ) { t.Helper() @@ -50,7 +49,7 @@ func RunAllowListEventTests( { Role: allowlist.AdminRole.Big(), Account: testAddress, - Sender: adminAddress, + Sender: adminAuth.From, OldRole: allowlist.NoRole.Big(), }, }, @@ -66,7 +65,7 @@ func RunAllowListEventTests( { Role: allowlist.ManagerRole.Big(), Account: testAddress, - Sender: adminAddress, + Sender: adminAuth.From, OldRole: allowlist.NoRole.Big(), }, }, @@ -82,7 +81,7 @@ func RunAllowListEventTests( { Role: allowlist.EnabledRole.Big(), Account: testAddress, - Sender: adminAddress, + Sender: adminAuth.From, OldRole: allowlist.NoRole.Big(), }, }, @@ -103,13 +102,13 @@ func RunAllowListEventTests( { Role: allowlist.EnabledRole.Big(), Account: testAddress, - Sender: adminAddress, + Sender: adminAuth.From, OldRole: allowlist.NoRole.Big(), }, { Role: allowlist.NoRole.Big(), Account: testAddress, - Sender: adminAddress, + Sender: adminAuth.From, OldRole: allowlist.EnabledRole.Big(), }, }, diff --git a/precompile/contracts/deployerallowlist/simulated_test.go b/precompile/contracts/deployerallowlist/simulated_test.go index 444aef4eca..fa26857201 100644 --- a/precompile/contracts/deployerallowlist/simulated_test.go +++ b/precompile/contracts/deployerallowlist/simulated_test.go @@ -218,5 +218,5 @@ func TestDeployerAllowList(t *testing.T) { func TestIAllowList_Events(t *testing.T) { admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) - allowlisttest.RunAllowListEventTests(t, newBackendWithDeployerAllowList, deployerallowlist.ContractAddress, admin, adminAddress) + allowlisttest.RunAllowListEventTests(t, newBackendWithDeployerAllowList, deployerallowlist.ContractAddress, admin) } diff --git a/precompile/contracts/txallowlist/simulated_test.go b/precompile/contracts/txallowlist/simulated_test.go index 23ee07d8a5..ccea4d378e 100644 --- a/precompile/contracts/txallowlist/simulated_test.go +++ b/precompile/contracts/txallowlist/simulated_test.go @@ -17,6 +17,7 @@ import ( "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" + "github.com/ava-labs/subnet-evm/plugin/evm/vmerrors" "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" "github.com/ava-labs/subnet-evm/precompile/contracts/testutils" @@ -72,6 +73,7 @@ func deployAllowListTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) func TestTxAllowList(t *testing.T) { chainID := params.TestChainConfig.ChainID admin := testutils.NewAuth(t, adminKey, chainID) + unprivileged := testutils.NewAuth(t, unprivilegedKey, chainID) type testCase struct { name string @@ -92,6 +94,15 @@ func TestTxAllowList(t *testing.T) { allowlisttest.VerifyRole(t, allowList, allowListTestAddr, allowlist.NoRole) }, }, + { + name: "should not let non-enabled address submit txs", + test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { + allowlisttest.VerifyRole(t, allowList, unprivilegedAddress, allowlist.NoRole) + + _, _, _, err := allowlistbindings.DeployAllowListTest(unprivileged, backend.Client(), txallowlist.ContractAddress) + require.ErrorContains(t, err, vmerrors.ErrSenderAddressNotAllowListed.Error()) //nolint:forbidigo // upstream error wrapped as string + }, + }, { name: "should verify contract correctly reports admin status", test: func(t *testing.T, backend *sim.Backend, allowList *allowlistbindings.IAllowList) { @@ -292,5 +303,5 @@ func TestTxAllowList(t *testing.T) { func TestIAllowList_Events(t *testing.T) { admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) - allowlisttest.RunAllowListEventTests(t, newBackendWithTxAllowList, txallowlist.ContractAddress, admin, adminAddress) + allowlisttest.RunAllowListEventTests(t, newBackendWithTxAllowList, txallowlist.ContractAddress, admin) } From 1e0d2fe35d16e36be08f980c249168d3f839c54a Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 12:03:57 -0500 Subject: [PATCH 09/73] style: ignore lint error for now --- precompile/contracts/txallowlist/simulated_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/contracts/txallowlist/simulated_test.go b/precompile/contracts/txallowlist/simulated_test.go index ccea4d378e..0c0b1afe3e 100644 --- a/precompile/contracts/txallowlist/simulated_test.go +++ b/precompile/contracts/txallowlist/simulated_test.go @@ -100,7 +100,7 @@ func TestTxAllowList(t *testing.T) { allowlisttest.VerifyRole(t, allowList, unprivilegedAddress, allowlist.NoRole) _, _, _, err := allowlistbindings.DeployAllowListTest(unprivileged, backend.Client(), txallowlist.ContractAddress) - require.ErrorContains(t, err, vmerrors.ErrSenderAddressNotAllowListed.Error()) //nolint:forbidigo // upstream error wrapped as string + require.ErrorContains(t, err, vmerrors.ErrSenderAddressNotAllowListed.Error()) // //nolint:forbidigo // upstream error wrapped as string }, }, { From 1069395169e572c5253c9832fc91e72809aeabcf Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 14:48:10 -0500 Subject: [PATCH 10/73] test: add helper function for backend --- .../allowlisttest/test_allowlist_events.go | 6 +++-- .../deployerallowlist/simulated_test.go | 27 +++---------------- .../contracts/feemanager/simulated_test.go | 27 +++---------------- .../contracts/nativeminter/simulated_test.go | 27 +++---------------- .../contracts/testutils/simulated_helpers.go | 21 +++++++++++++++ .../contracts/txallowlist/simulated_test.go | 27 +++---------------- 6 files changed, 41 insertions(+), 94 deletions(-) diff --git a/precompile/allowlist/allowlisttest/test_allowlist_events.go b/precompile/allowlist/allowlisttest/test_allowlist_events.go index 07cb4b7d58..178821bc4b 100644 --- a/precompile/allowlist/allowlisttest/test_allowlist_events.go +++ b/precompile/allowlist/allowlisttest/test_allowlist_events.go @@ -13,6 +13,7 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/contracts/testutils" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" sim "github.com/ava-labs/subnet-evm/ethclient/simulated" allowlistbindings "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest/bindings" @@ -22,9 +23,10 @@ import ( // This can be used by any precompile that uses the AllowList pattern. func RunAllowListEventTests( t *testing.T, - newBackend func(t *testing.T) *sim.Backend, + precompileCfg precompileconfig.Config, contractAddress common.Address, adminAuth *bind.TransactOpts, + fundedAddrs ...common.Address, ) { t.Helper() @@ -119,7 +121,7 @@ func RunAllowListEventTests( t.Run(tc.name, func(t *testing.T) { require := require.New(t) - backend := newBackend(t) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, fundedAddrs...) defer backend.Close() allowList, err := allowlistbindings.NewIAllowList(contractAddress, backend.Client()) diff --git a/precompile/contracts/deployerallowlist/simulated_test.go b/precompile/contracts/deployerallowlist/simulated_test.go index fa26857201..738fc8e4c2 100644 --- a/precompile/contracts/deployerallowlist/simulated_test.go +++ b/precompile/contracts/deployerallowlist/simulated_test.go @@ -4,11 +4,9 @@ package deployerallowlist_test import ( - "math/big" "testing" "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" "github.com/ava-labs/libevm/core/vm" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" @@ -16,7 +14,6 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core" "github.com/ava-labs/subnet-evm/params" - "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" @@ -44,24 +41,6 @@ func TestMain(m *testing.M) { m.Run() } -func newBackendWithDeployerAllowList(t *testing.T) *sim.Backend { - t.Helper() - chainCfg := params.Copy(params.TestChainConfig) - // Enable ContractDeployerAllowList at genesis with admin set to adminAddress. - params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ - deployerallowlist.ConfigKey: deployerallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil), - } - return sim.NewBackend( - types.GenesisAlloc{ - adminAddress: {Balance: big.NewInt(1000000000000000000)}, - unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, - }, - sim.WithChainConfig(&chainCfg), - ) -} - -// Helper functions to reduce test boilerplate - func deployAllowListTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *allowlistbindings.AllowListTest) { t.Helper() addr, tx, contract, err := allowlistbindings.DeployAllowListTest(auth, b.Client(), deployerallowlist.ContractAddress) @@ -203,9 +182,10 @@ func TestDeployerAllowList(t *testing.T) { }, } + precompileCfg := deployerallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := newBackendWithDeployerAllowList(t) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) defer backend.Close() allowList, err := allowlistbindings.NewIAllowList(deployerallowlist.ContractAddress, backend.Client()) @@ -217,6 +197,7 @@ func TestDeployerAllowList(t *testing.T) { } func TestIAllowList_Events(t *testing.T) { + precompileCfg := deployerallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil) admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) - allowlisttest.RunAllowListEventTests(t, newBackendWithDeployerAllowList, deployerallowlist.ContractAddress, admin) + allowlisttest.RunAllowListEventTests(t, precompileCfg, deployerallowlist.ContractAddress, admin, adminAddress, unprivilegedAddress) } diff --git a/precompile/contracts/feemanager/simulated_test.go b/precompile/contracts/feemanager/simulated_test.go index 739132351c..2d85a62e13 100644 --- a/precompile/contracts/feemanager/simulated_test.go +++ b/precompile/contracts/feemanager/simulated_test.go @@ -16,7 +16,6 @@ import ( "github.com/ava-labs/subnet-evm/commontype" "github.com/ava-labs/subnet-evm/core" "github.com/ava-labs/subnet-evm/params" - "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" @@ -68,26 +67,6 @@ func TestMain(m *testing.M) { m.Run() } -func newBackendWithFeeManager(t *testing.T) *sim.Backend { - t.Helper() - chainCfg := params.Copy(params.TestChainConfig) - - // Enable FeeManager at genesis with admin set to adminAddress and initial fee config. - params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ - feemanager.ConfigKey: feemanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, &genesisFeeConfig), - } - - return sim.NewBackend( - types.GenesisAlloc{ - adminAddress: {Balance: big.NewInt(1000000000000000000)}, - unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, - }, - sim.WithChainConfig(&chainCfg), - ) -} - -// Helper functions to reduce test boilerplate - func deployFeeManagerTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *feemanagerbindings.FeeManagerTest) { t.Helper() addr, tx, contract, err := feemanagerbindings.DeployFeeManagerTest(auth, b.Client(), feemanager.ContractAddress) @@ -252,9 +231,10 @@ func TestFeeManager(t *testing.T) { }, } + precompileCfg := feemanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, &genesisFeeConfig) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := newBackendWithFeeManager(t) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) defer backend.Close() feeManager, err := feemanagerbindings.NewIFeeManager(feemanager.ContractAddress, backend.Client()) @@ -269,7 +249,8 @@ func TestIFeeManager_Events(t *testing.T) { chainID := params.TestChainConfig.ChainID admin := testutils.NewAuth(t, adminKey, chainID) - backend := newBackendWithFeeManager(t) + precompileCfg := feemanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, &genesisFeeConfig) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) defer backend.Close() feeManager, err := feemanagerbindings.NewIFeeManager(feemanager.ContractAddress, backend.Client()) diff --git a/precompile/contracts/nativeminter/simulated_test.go b/precompile/contracts/nativeminter/simulated_test.go index 54b94f1be3..546ed4b41e 100644 --- a/precompile/contracts/nativeminter/simulated_test.go +++ b/precompile/contracts/nativeminter/simulated_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" "github.com/ava-labs/libevm/core/vm" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" @@ -16,7 +15,6 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core" "github.com/ava-labs/subnet-evm/params" - "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" @@ -44,25 +42,6 @@ func TestMain(m *testing.M) { m.Run() } -func newBackendWithNativeMinter(t *testing.T) *sim.Backend { - t.Helper() - chainCfg := params.Copy(params.TestChainConfig) - - // Enable ContractNativeMinter at genesis with admin set to adminAddress. - params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ - nativeminter.ConfigKey: nativeminter.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), - } - return sim.NewBackend( - types.GenesisAlloc{ - adminAddress: {Balance: big.NewInt(1000000000000000000)}, - unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, - }, - sim.WithChainConfig(&chainCfg), - ) -} - -// Helper functions to reduce test boilerplate - func deployNativeMinterTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *nativeminterbindings.NativeMinterTest) { t.Helper() addr, tx, contract, err := nativeminterbindings.DeployNativeMinterTest(auth, b.Client(), nativeminter.ContractAddress) @@ -164,9 +143,10 @@ func TestNativeMinter(t *testing.T) { }, } + precompileCfg := nativeminter.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := newBackendWithNativeMinter(t) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) defer backend.Close() nativeMinter, err := nativeminterbindings.NewINativeMinter(nativeminter.ContractAddress, backend.Client()) @@ -183,7 +163,8 @@ func TestINativeMinter_Events(t *testing.T) { testKey, _ := crypto.GenerateKey() testAddress := crypto.PubkeyToAddress(testKey.PublicKey) - backend := newBackendWithNativeMinter(t) + precompileCfg := nativeminter.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) defer backend.Close() nativeMinter, err := nativeminterbindings.NewINativeMinter(nativeminter.ContractAddress, backend.Client()) diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 739a4b4134..8cce014eed 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -8,10 +8,14 @@ import ( "math/big" "testing" + "github.com/ava-labs/libevm/common" "github.com/ava-labs/libevm/core/types" "github.com/stretchr/testify/require" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/params" + "github.com/ava-labs/subnet-evm/params/extras" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" sim "github.com/ava-labs/subnet-evm/ethclient/simulated" ) @@ -24,6 +28,23 @@ func NewAuth(t *testing.T, key *ecdsa.PrivateKey, chainID *big.Int) *bind.Transa return auth } +// NewBackendWithPrecompile creates a simulated backend with the given precompile enabled +// at genesis and funds the specified addresses with 1 ETH each. +func NewBackendWithPrecompile(t *testing.T, precompileCfg precompileconfig.Config, fundedAddrs ...common.Address) *sim.Backend { + t.Helper() + chainCfg := params.Copy(params.TestChainConfig) + params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ + precompileCfg.Key(): precompileCfg, + } + + genesisAlloc := make(types.GenesisAlloc) + for _, addr := range fundedAddrs { + genesisAlloc[addr] = types.Account{Balance: big.NewInt(1000000000000000000)} + } + + return sim.NewBackend(genesisAlloc, sim.WithChainConfig(&chainCfg)) +} + // WaitReceipt commits the simulated backend and waits for the transaction receipt. func WaitReceipt(t *testing.T, b *sim.Backend, tx *types.Transaction) *types.Receipt { t.Helper() diff --git a/precompile/contracts/txallowlist/simulated_test.go b/precompile/contracts/txallowlist/simulated_test.go index 0c0b1afe3e..83d284fd2c 100644 --- a/precompile/contracts/txallowlist/simulated_test.go +++ b/precompile/contracts/txallowlist/simulated_test.go @@ -4,18 +4,15 @@ package txallowlist_test import ( - "math/big" "testing" "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core" "github.com/ava-labs/subnet-evm/params" - "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" "github.com/ava-labs/subnet-evm/plugin/evm/vmerrors" "github.com/ava-labs/subnet-evm/precompile/allowlist" @@ -44,24 +41,6 @@ func TestMain(m *testing.M) { m.Run() } -func newBackendWithTxAllowList(t *testing.T) *sim.Backend { - t.Helper() - chainCfg := params.Copy(params.TestChainConfig) - // Enable TxAllowList at genesis with admin set to adminAddress. - params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ - txallowlist.ConfigKey: txallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil), - } - return sim.NewBackend( - types.GenesisAlloc{ - adminAddress: {Balance: big.NewInt(1000000000000000000)}, - unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, - }, - sim.WithChainConfig(&chainCfg), - ) -} - -// Helper functions to reduce test boilerplate - func deployAllowListTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *allowlistbindings.AllowListTest) { t.Helper() addr, tx, contract, err := allowlistbindings.DeployAllowListTest(auth, b.Client(), txallowlist.ContractAddress) @@ -288,9 +267,10 @@ func TestTxAllowList(t *testing.T) { }, } + precompileCfg := txallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := newBackendWithTxAllowList(t) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) defer backend.Close() allowList, err := allowlistbindings.NewIAllowList(txallowlist.ContractAddress, backend.Client()) @@ -302,6 +282,7 @@ func TestTxAllowList(t *testing.T) { } func TestIAllowList_Events(t *testing.T) { + precompileCfg := txallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil) admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) - allowlisttest.RunAllowListEventTests(t, newBackendWithTxAllowList, txallowlist.ContractAddress, admin) + allowlisttest.RunAllowListEventTests(t, precompileCfg, txallowlist.ContractAddress, admin, adminAddress, unprivilegedAddress) } From f519cccd5af7362e7bc9e5f7178f956a36473559 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 15:10:15 -0500 Subject: [PATCH 11/73] chore: lint --- precompile/contracts/txallowlist/simulated_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/precompile/contracts/txallowlist/simulated_test.go b/precompile/contracts/txallowlist/simulated_test.go index 83d284fd2c..20a6a98028 100644 --- a/precompile/contracts/txallowlist/simulated_test.go +++ b/precompile/contracts/txallowlist/simulated_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" @@ -143,7 +144,7 @@ func TestTxAllowList(t *testing.T) { // Try to set another address as enabled - should fail _, err := allowListTest.SetEnabled(admin, otherContractAddr) - require.ErrorContains(t, err, "execution reverted") + require.ErrorContains(t, err, vm.ErrExecutionReverted.Error()) //nolint:forbidigo // upstream error wrapped as string allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.NoRole) }, @@ -217,7 +218,7 @@ func TestTxAllowList(t *testing.T) { allowlisttest.SetAsAdmin(t, backend, allowList, admin, adminContractAddr) _, err := managerContract.Revoke(admin, adminContractAddr) - require.ErrorContains(t, err, "execution reverted") + require.ErrorContains(t, err, vm.ErrExecutionReverted.Error()) //nolint:forbidigo // upstream error wrapped as string allowlisttest.VerifyRole(t, allowList, adminContractAddr, allowlist.AdminRole) }, @@ -231,7 +232,7 @@ func TestTxAllowList(t *testing.T) { allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) _, err := managerContract.SetAdmin(admin, otherContractAddr) - require.ErrorContains(t, err, "execution reverted") + require.ErrorContains(t, err, vm.ErrExecutionReverted.Error()) //nolint:forbidigo // upstream error wrapped as string allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.NoRole) }, @@ -245,7 +246,7 @@ func TestTxAllowList(t *testing.T) { allowlisttest.SetAsManager(t, backend, allowList, admin, managerContractAddr) _, err := managerContract.SetManager(admin, otherContractAddr) - require.ErrorContains(t, err, "execution reverted") + require.ErrorContains(t, err, vm.ErrExecutionReverted.Error()) //nolint:forbidigo // upstream error wrapped as string allowlisttest.VerifyRole(t, allowList, otherContractAddr, allowlist.NoRole) }, @@ -260,7 +261,7 @@ func TestTxAllowList(t *testing.T) { allowlisttest.SetAsManager(t, backend, allowList, admin, manager2Addr) _, err := manager1Contract.Revoke(admin, manager2Addr) - require.ErrorContains(t, err, "execution reverted") + require.ErrorContains(t, err, vm.ErrExecutionReverted.Error()) //nolint:forbidigo // upstream error wrapped as string allowlisttest.VerifyRole(t, allowList, manager2Addr, allowlist.ManagerRole) }, From df3d4d18aa6ba3fa0c5b567a4a2d4a990e8037ed Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 16:26:00 -0500 Subject: [PATCH 12/73] chore: delete more deprecated code --- contracts/bindings/gen_allowlist.go | 606 ----------------- contracts/bindings/gen_exampletxallowlist.go | 627 ------------------ contracts/contracts/AllowList.sol | 82 --- contracts/contracts/interfaces/IAllowList.sol | 21 - contracts/contracts/test/AllowListTest.sol | 11 - contracts/index.ts | 1 - contracts/tasks.ts | 92 --- contracts/test/utils.ts | 132 ---- tests/precompile/solidity/suites.go | 25 - 9 files changed, 1597 deletions(-) delete mode 100644 contracts/bindings/gen_allowlist.go delete mode 100644 contracts/bindings/gen_exampletxallowlist.go delete mode 100644 contracts/contracts/AllowList.sol delete mode 100644 contracts/contracts/interfaces/IAllowList.sol delete mode 100644 contracts/contracts/test/AllowListTest.sol delete mode 100644 contracts/index.ts delete mode 100644 contracts/tasks.ts delete mode 100644 contracts/test/utils.ts diff --git a/contracts/bindings/gen_allowlist.go b/contracts/bindings/gen_allowlist.go deleted file mode 100644 index d4f8b4c72f..0000000000 --- a/contracts/bindings/gen_allowlist.go +++ /dev/null @@ -1,606 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package bindings - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ava-labs/libevm" - "github.com/ava-labs/libevm/accounts/abi" - "github.com/ava-labs/libevm/accounts/abi/bind" - "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" - "github.com/ava-labs/libevm/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// AllowListMetaData contains all meta data concerning the AllowList contract. -var AllowListMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610d39380380610d3983398181016040528101906100319190610217565b335f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100a2575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100999190610251565b60405180910390fd5b6100b1816100f860201b60201c565b508060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505061026a565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101e6826101bd565b9050919050565b6101f6816101dc565b8114610200575f5ffd5b50565b5f81519050610211816101ed565b92915050565b5f6020828403121561022c5761022b6101b9565b5b5f61023984828501610203565b91505092915050565b61024b816101dc565b82525050565b5f6020820190506102645f830184610242565b92915050565b610ac2806102775f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c80638da5cb5b116100645780638da5cb5b1461012e5780639015d3711461014c578063d0ebdbe71461017c578063f2fde38b14610198578063f3ae2415146101b45761009c565b80630aaf7043146100a057806324d7806c146100bc578063704b6c02146100ec578063715018a61461010857806374a8f10314610112575b5f5ffd5b6100ba60048036038101906100b59190610930565b6101e4565b005b6100d660048036038101906100d19190610930565b6101f8565b6040516100e39190610975565b60405180910390f35b61010660048036038101906101019190610930565b6102a1565b005b6101106102b5565b005b61012c60048036038101906101279190610930565b6102c8565b005b6101366102dc565b604051610143919061099d565b60405180910390f35b61016660048036038101906101619190610930565b610303565b6040516101739190610975565b60405180910390f35b61019660048036038101906101919190610930565b6103ac565b005b6101b260048036038101906101ad9190610930565b6103c0565b005b6101ce60048036038101906101c99190610930565b610444565b6040516101db9190610975565b60405180910390f35b6101ec6104ed565b6101f581610574565b50565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b8152600401610254919061099d565b602060405180830381865afa15801561026f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029391906109e9565b905060028114915050919050565b6102a96104ed565b6102b2816105fe565b50565b6102bd6104ed565b6102c65f610688565b565b6102d06104ed565b6102d981610749565b50565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161035f919061099d565b602060405180830381865afa15801561037a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061039e91906109e9565b90505f811415915050919050565b6103b46104ed565b6103bd81610841565b50565b6103c86104ed565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610438575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161042f919061099d565b60405180910390fd5b61044181610688565b50565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104a0919061099d565b602060405180830381865afa1580156104bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104df91906109e9565b905060038114915050919050565b6104f56108cb565b73ffffffffffffffffffffffffffffffffffffffff166105136102dc565b73ffffffffffffffffffffffffffffffffffffffff1614610572576105366108cb565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610569919061099d565b60405180910390fd5b565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b81526004016105ce919061099d565b5f604051808303815f87803b1580156105e5575f5ffd5b505af11580156105f7573d5f5f3e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b8152600401610658919061099d565b5f604051808303815f87803b15801561066f575f5ffd5b505af1158015610681573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036107b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ae90610a6e565b60405180910390fd5b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b8152600401610811919061099d565b5f604051808303815f87803b158015610828575f5ffd5b505af115801561083a573d5f5f3e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b815260040161089b919061099d565b5f604051808303815f87803b1580156108b2575f5ffd5b505af11580156108c4573d5f5f3e3d5ffd5b5050505050565b5f33905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6108ff826108d6565b9050919050565b61090f816108f5565b8114610919575f5ffd5b50565b5f8135905061092a81610906565b92915050565b5f60208284031215610945576109446108d2565b5b5f6109528482850161091c565b91505092915050565b5f8115159050919050565b61096f8161095b565b82525050565b5f6020820190506109885f830184610966565b92915050565b610997816108f5565b82525050565b5f6020820190506109b05f83018461098e565b92915050565b5f819050919050565b6109c8816109b6565b81146109d2575f5ffd5b50565b5f815190506109e3816109bf565b92915050565b5f602082840312156109fe576109fd6108d2565b5b5f610a0b848285016109d5565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f610a58601683610a14565b9150610a6382610a24565b602082019050919050565b5f6020820190508181035f830152610a8581610a4c565b905091905056fea2646970667358221220f2f732d978442b49b0ecfe1af950516a759b83444ac4a17d361717e17f3cee4464736f6c634300081e0033", -} - -// AllowListABI is the input ABI used to generate the binding from. -// Deprecated: Use AllowListMetaData.ABI instead. -var AllowListABI = AllowListMetaData.ABI - -// AllowListBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use AllowListMetaData.Bin instead. -var AllowListBin = AllowListMetaData.Bin - -// DeployAllowList deploys a new Ethereum contract, binding an instance of AllowList to it. -func DeployAllowList(auth *bind.TransactOpts, backend bind.ContractBackend, precompileAddr common.Address) (common.Address, *types.Transaction, *AllowList, error) { - parsed, err := AllowListMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(AllowListBin), backend, precompileAddr) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &AllowList{AllowListCaller: AllowListCaller{contract: contract}, AllowListTransactor: AllowListTransactor{contract: contract}, AllowListFilterer: AllowListFilterer{contract: contract}}, nil -} - -// AllowList is an auto generated Go binding around an Ethereum contract. -type AllowList struct { - AllowListCaller // Read-only binding to the contract - AllowListTransactor // Write-only binding to the contract - AllowListFilterer // Log filterer for contract events -} - -// AllowListCaller is an auto generated read-only Go binding around an Ethereum contract. -type AllowListCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// AllowListTransactor is an auto generated write-only Go binding around an Ethereum contract. -type AllowListTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// AllowListFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type AllowListFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// AllowListSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type AllowListSession struct { - Contract *AllowList // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// AllowListCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type AllowListCallerSession struct { - Contract *AllowListCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// AllowListTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type AllowListTransactorSession struct { - Contract *AllowListTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// AllowListRaw is an auto generated low-level Go binding around an Ethereum contract. -type AllowListRaw struct { - Contract *AllowList // Generic contract binding to access the raw methods on -} - -// AllowListCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type AllowListCallerRaw struct { - Contract *AllowListCaller // Generic read-only contract binding to access the raw methods on -} - -// AllowListTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type AllowListTransactorRaw struct { - Contract *AllowListTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewAllowList creates a new instance of AllowList, bound to a specific deployed contract. -func NewAllowList(address common.Address, backend bind.ContractBackend) (*AllowList, error) { - contract, err := bindAllowList(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &AllowList{AllowListCaller: AllowListCaller{contract: contract}, AllowListTransactor: AllowListTransactor{contract: contract}, AllowListFilterer: AllowListFilterer{contract: contract}}, nil -} - -// NewAllowListCaller creates a new read-only instance of AllowList, bound to a specific deployed contract. -func NewAllowListCaller(address common.Address, caller bind.ContractCaller) (*AllowListCaller, error) { - contract, err := bindAllowList(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &AllowListCaller{contract: contract}, nil -} - -// NewAllowListTransactor creates a new write-only instance of AllowList, bound to a specific deployed contract. -func NewAllowListTransactor(address common.Address, transactor bind.ContractTransactor) (*AllowListTransactor, error) { - contract, err := bindAllowList(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &AllowListTransactor{contract: contract}, nil -} - -// NewAllowListFilterer creates a new log filterer instance of AllowList, bound to a specific deployed contract. -func NewAllowListFilterer(address common.Address, filterer bind.ContractFilterer) (*AllowListFilterer, error) { - contract, err := bindAllowList(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &AllowListFilterer{contract: contract}, nil -} - -// bindAllowList binds a generic wrapper to an already deployed contract. -func bindAllowList(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := AllowListMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_AllowList *AllowListRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _AllowList.Contract.AllowListCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_AllowList *AllowListRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _AllowList.Contract.AllowListTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_AllowList *AllowListRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _AllowList.Contract.AllowListTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_AllowList *AllowListCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _AllowList.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_AllowList *AllowListTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _AllowList.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_AllowList *AllowListTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _AllowList.Contract.contract.Transact(opts, method, params...) -} - -// IsAdmin is a free data retrieval call binding the contract method 0x24d7806c. -// -// Solidity: function isAdmin(address addr) view returns(bool) -func (_AllowList *AllowListCaller) IsAdmin(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _AllowList.contract.Call(opts, &out, "isAdmin", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsAdmin is a free data retrieval call binding the contract method 0x24d7806c. -// -// Solidity: function isAdmin(address addr) view returns(bool) -func (_AllowList *AllowListSession) IsAdmin(addr common.Address) (bool, error) { - return _AllowList.Contract.IsAdmin(&_AllowList.CallOpts, addr) -} - -// IsAdmin is a free data retrieval call binding the contract method 0x24d7806c. -// -// Solidity: function isAdmin(address addr) view returns(bool) -func (_AllowList *AllowListCallerSession) IsAdmin(addr common.Address) (bool, error) { - return _AllowList.Contract.IsAdmin(&_AllowList.CallOpts, addr) -} - -// IsEnabled is a free data retrieval call binding the contract method 0x9015d371. -// -// Solidity: function isEnabled(address addr) view returns(bool) -func (_AllowList *AllowListCaller) IsEnabled(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _AllowList.contract.Call(opts, &out, "isEnabled", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsEnabled is a free data retrieval call binding the contract method 0x9015d371. -// -// Solidity: function isEnabled(address addr) view returns(bool) -func (_AllowList *AllowListSession) IsEnabled(addr common.Address) (bool, error) { - return _AllowList.Contract.IsEnabled(&_AllowList.CallOpts, addr) -} - -// IsEnabled is a free data retrieval call binding the contract method 0x9015d371. -// -// Solidity: function isEnabled(address addr) view returns(bool) -func (_AllowList *AllowListCallerSession) IsEnabled(addr common.Address) (bool, error) { - return _AllowList.Contract.IsEnabled(&_AllowList.CallOpts, addr) -} - -// IsManager is a free data retrieval call binding the contract method 0xf3ae2415. -// -// Solidity: function isManager(address addr) view returns(bool) -func (_AllowList *AllowListCaller) IsManager(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _AllowList.contract.Call(opts, &out, "isManager", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsManager is a free data retrieval call binding the contract method 0xf3ae2415. -// -// Solidity: function isManager(address addr) view returns(bool) -func (_AllowList *AllowListSession) IsManager(addr common.Address) (bool, error) { - return _AllowList.Contract.IsManager(&_AllowList.CallOpts, addr) -} - -// IsManager is a free data retrieval call binding the contract method 0xf3ae2415. -// -// Solidity: function isManager(address addr) view returns(bool) -func (_AllowList *AllowListCallerSession) IsManager(addr common.Address) (bool, error) { - return _AllowList.Contract.IsManager(&_AllowList.CallOpts, addr) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_AllowList *AllowListCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _AllowList.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_AllowList *AllowListSession) Owner() (common.Address, error) { - return _AllowList.Contract.Owner(&_AllowList.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_AllowList *AllowListCallerSession) Owner() (common.Address, error) { - return _AllowList.Contract.Owner(&_AllowList.CallOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_AllowList *AllowListTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _AllowList.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_AllowList *AllowListSession) RenounceOwnership() (*types.Transaction, error) { - return _AllowList.Contract.RenounceOwnership(&_AllowList.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_AllowList *AllowListTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _AllowList.Contract.RenounceOwnership(&_AllowList.TransactOpts) -} - -// Revoke is a paid mutator transaction binding the contract method 0x74a8f103. -// -// Solidity: function revoke(address addr) returns() -func (_AllowList *AllowListTransactor) Revoke(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _AllowList.contract.Transact(opts, "revoke", addr) -} - -// Revoke is a paid mutator transaction binding the contract method 0x74a8f103. -// -// Solidity: function revoke(address addr) returns() -func (_AllowList *AllowListSession) Revoke(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.Revoke(&_AllowList.TransactOpts, addr) -} - -// Revoke is a paid mutator transaction binding the contract method 0x74a8f103. -// -// Solidity: function revoke(address addr) returns() -func (_AllowList *AllowListTransactorSession) Revoke(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.Revoke(&_AllowList.TransactOpts, addr) -} - -// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. -// -// Solidity: function setAdmin(address addr) returns() -func (_AllowList *AllowListTransactor) SetAdmin(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _AllowList.contract.Transact(opts, "setAdmin", addr) -} - -// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. -// -// Solidity: function setAdmin(address addr) returns() -func (_AllowList *AllowListSession) SetAdmin(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.SetAdmin(&_AllowList.TransactOpts, addr) -} - -// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. -// -// Solidity: function setAdmin(address addr) returns() -func (_AllowList *AllowListTransactorSession) SetAdmin(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.SetAdmin(&_AllowList.TransactOpts, addr) -} - -// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. -// -// Solidity: function setEnabled(address addr) returns() -func (_AllowList *AllowListTransactor) SetEnabled(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _AllowList.contract.Transact(opts, "setEnabled", addr) -} - -// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. -// -// Solidity: function setEnabled(address addr) returns() -func (_AllowList *AllowListSession) SetEnabled(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.SetEnabled(&_AllowList.TransactOpts, addr) -} - -// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. -// -// Solidity: function setEnabled(address addr) returns() -func (_AllowList *AllowListTransactorSession) SetEnabled(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.SetEnabled(&_AllowList.TransactOpts, addr) -} - -// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. -// -// Solidity: function setManager(address addr) returns() -func (_AllowList *AllowListTransactor) SetManager(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _AllowList.contract.Transact(opts, "setManager", addr) -} - -// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. -// -// Solidity: function setManager(address addr) returns() -func (_AllowList *AllowListSession) SetManager(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.SetManager(&_AllowList.TransactOpts, addr) -} - -// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. -// -// Solidity: function setManager(address addr) returns() -func (_AllowList *AllowListTransactorSession) SetManager(addr common.Address) (*types.Transaction, error) { - return _AllowList.Contract.SetManager(&_AllowList.TransactOpts, addr) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_AllowList *AllowListTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _AllowList.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_AllowList *AllowListSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _AllowList.Contract.TransferOwnership(&_AllowList.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_AllowList *AllowListTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _AllowList.Contract.TransferOwnership(&_AllowList.TransactOpts, newOwner) -} - -// AllowListOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the AllowList contract. -type AllowListOwnershipTransferredIterator struct { - Event *AllowListOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *AllowListOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(AllowListOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(AllowListOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *AllowListOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *AllowListOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// AllowListOwnershipTransferred represents a OwnershipTransferred event raised by the AllowList contract. -type AllowListOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_AllowList *AllowListFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*AllowListOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _AllowList.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &AllowListOwnershipTransferredIterator{contract: _AllowList.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_AllowList *AllowListFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *AllowListOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _AllowList.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(AllowListOwnershipTransferred) - if err := _AllowList.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_AllowList *AllowListFilterer) ParseOwnershipTransferred(log types.Log) (*AllowListOwnershipTransferred, error) { - event := new(AllowListOwnershipTransferred) - if err := _AllowList.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/contracts/bindings/gen_exampletxallowlist.go b/contracts/bindings/gen_exampletxallowlist.go deleted file mode 100644 index 6c451ee946..0000000000 --- a/contracts/bindings/gen_exampletxallowlist.go +++ /dev/null @@ -1,627 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package bindings - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ava-labs/libevm" - "github.com/ava-labs/libevm/accounts/abi" - "github.com/ava-labs/libevm/accounts/abi/bind" - "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" - "github.com/ava-labs/libevm/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// ExampleTxAllowListMetaData contains all meta data concerning the ExampleTxAllowList contract. -var ExampleTxAllowListMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50730200000000000000000000000000000000000002335f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610096575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161008d91906101ec565b60405180910390fd5b6100a5816100ec60201b60201c565b508060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610205565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101d6826101ad565b9050919050565b6101e6816101cc565b82525050565b5f6020820190506101ff5f8301846101dd565b92915050565b610b64806102125f395ff3fe608060405234801561000f575f5ffd5b50600436106100a7575f3560e01c806374a8f1031161006f57806374a8f103146101275780638da5cb5b146101435780639015d37114610161578063d0ebdbe714610191578063f2fde38b146101ad578063f3ae2415146101c9576100a7565b80630aaf7043146100ab57806324d7806c146100c75780636cd5c39b146100f7578063704b6c0214610101578063715018a61461011d575b5f5ffd5b6100c560048036038101906100c0919061097a565b6101f9565b005b6100e160048036038101906100dc919061097a565b61020d565b6040516100ee91906109bf565b60405180910390f35b6100ff6102b6565b005b61011b6004803603810190610116919061097a565b6102df565b005b6101256102f3565b005b610141600480360381019061013c919061097a565b610306565b005b61014b61031a565b60405161015891906109e7565b60405180910390f35b61017b6004803603810190610176919061097a565b610341565b60405161018891906109bf565b60405180910390f35b6101ab60048036038101906101a6919061097a565b6103ea565b005b6101c760048036038101906101c2919061097a565b6103fe565b005b6101e360048036038101906101de919061097a565b610482565b6040516101f091906109bf565b60405180910390f35b61020161052b565b61020a816105b2565b50565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161026991906109e7565b602060405180830381865afa158015610284573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102a89190610a33565b905060028114915050919050565b6040516102c290610910565b604051809103905ff0801580156102db573d5f5f3e3d5ffd5b5050565b6102e761052b565b6102f08161063c565b50565b6102fb61052b565b6103045f6106c6565b565b61030e61052b565b61031781610787565b50565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161039d91906109e7565b602060405180830381865afa1580156103b8573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103dc9190610a33565b90505f811415915050919050565b6103f261052b565b6103fb8161087f565b50565b61040661052b565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610476575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161046d91906109e7565b60405180910390fd5b61047f816106c6565b50565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104de91906109e7565b602060405180830381865afa1580156104f9573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051d9190610a33565b905060038114915050919050565b610533610909565b73ffffffffffffffffffffffffffffffffffffffff1661055161031a565b73ffffffffffffffffffffffffffffffffffffffff16146105b057610574610909565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016105a791906109e7565b60405180910390fd5b565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161060c91906109e7565b5f604051808303815f87803b158015610623575f5ffd5b505af1158015610635573d5f5f3e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b815260040161069691906109e7565b5f604051808303815f87803b1580156106ad575f5ffd5b505af11580156106bf573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036107f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ec90610ab8565b60405180910390fd5b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161084f91906109e7565b5f604051808303815f87803b158015610866575f5ffd5b505af1158015610878573d5f5f3e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016108d991906109e7565b5f604051808303815f87803b1580156108f0575f5ffd5b505af1158015610902573d5f5f3e3d5ffd5b5050505050565b5f33905090565b605880610ad783390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61094982610920565b9050919050565b6109598161093f565b8114610963575f5ffd5b50565b5f8135905061097481610950565b92915050565b5f6020828403121561098f5761098e61091c565b5b5f61099c84828501610966565b91505092915050565b5f8115159050919050565b6109b9816109a5565b82525050565b5f6020820190506109d25f8301846109b0565b92915050565b6109e18161093f565b82525050565b5f6020820190506109fa5f8301846109d8565b92915050565b5f819050919050565b610a1281610a00565b8114610a1c575f5ffd5b50565b5f81519050610a2d81610a09565b92915050565b5f60208284031215610a4857610a4761091c565b5b5f610a5584828501610a1f565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f610aa2601683610a5e565b9150610aad82610a6e565b602082019050919050565b5f6020820190508181035f830152610acf81610a96565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220aedbe0b8994e01f21097161356ab23bf8ba2eff27752ec3f93783e61960dc45a64736f6c634300081e0033a2646970667358221220a4be2d748c995fa42a055822677de3696a1c5994ff8558dfb971173a3bcee53564736f6c634300081e0033", -} - -// ExampleTxAllowListABI is the input ABI used to generate the binding from. -// Deprecated: Use ExampleTxAllowListMetaData.ABI instead. -var ExampleTxAllowListABI = ExampleTxAllowListMetaData.ABI - -// ExampleTxAllowListBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use ExampleTxAllowListMetaData.Bin instead. -var ExampleTxAllowListBin = ExampleTxAllowListMetaData.Bin - -// DeployExampleTxAllowList deploys a new Ethereum contract, binding an instance of ExampleTxAllowList to it. -func DeployExampleTxAllowList(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ExampleTxAllowList, error) { - parsed, err := ExampleTxAllowListMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ExampleTxAllowListBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &ExampleTxAllowList{ExampleTxAllowListCaller: ExampleTxAllowListCaller{contract: contract}, ExampleTxAllowListTransactor: ExampleTxAllowListTransactor{contract: contract}, ExampleTxAllowListFilterer: ExampleTxAllowListFilterer{contract: contract}}, nil -} - -// ExampleTxAllowList is an auto generated Go binding around an Ethereum contract. -type ExampleTxAllowList struct { - ExampleTxAllowListCaller // Read-only binding to the contract - ExampleTxAllowListTransactor // Write-only binding to the contract - ExampleTxAllowListFilterer // Log filterer for contract events -} - -// ExampleTxAllowListCaller is an auto generated read-only Go binding around an Ethereum contract. -type ExampleTxAllowListCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleTxAllowListTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ExampleTxAllowListTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleTxAllowListFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ExampleTxAllowListFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleTxAllowListSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ExampleTxAllowListSession struct { - Contract *ExampleTxAllowList // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ExampleTxAllowListCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ExampleTxAllowListCallerSession struct { - Contract *ExampleTxAllowListCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ExampleTxAllowListTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ExampleTxAllowListTransactorSession struct { - Contract *ExampleTxAllowListTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ExampleTxAllowListRaw is an auto generated low-level Go binding around an Ethereum contract. -type ExampleTxAllowListRaw struct { - Contract *ExampleTxAllowList // Generic contract binding to access the raw methods on -} - -// ExampleTxAllowListCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ExampleTxAllowListCallerRaw struct { - Contract *ExampleTxAllowListCaller // Generic read-only contract binding to access the raw methods on -} - -// ExampleTxAllowListTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ExampleTxAllowListTransactorRaw struct { - Contract *ExampleTxAllowListTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewExampleTxAllowList creates a new instance of ExampleTxAllowList, bound to a specific deployed contract. -func NewExampleTxAllowList(address common.Address, backend bind.ContractBackend) (*ExampleTxAllowList, error) { - contract, err := bindExampleTxAllowList(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ExampleTxAllowList{ExampleTxAllowListCaller: ExampleTxAllowListCaller{contract: contract}, ExampleTxAllowListTransactor: ExampleTxAllowListTransactor{contract: contract}, ExampleTxAllowListFilterer: ExampleTxAllowListFilterer{contract: contract}}, nil -} - -// NewExampleTxAllowListCaller creates a new read-only instance of ExampleTxAllowList, bound to a specific deployed contract. -func NewExampleTxAllowListCaller(address common.Address, caller bind.ContractCaller) (*ExampleTxAllowListCaller, error) { - contract, err := bindExampleTxAllowList(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ExampleTxAllowListCaller{contract: contract}, nil -} - -// NewExampleTxAllowListTransactor creates a new write-only instance of ExampleTxAllowList, bound to a specific deployed contract. -func NewExampleTxAllowListTransactor(address common.Address, transactor bind.ContractTransactor) (*ExampleTxAllowListTransactor, error) { - contract, err := bindExampleTxAllowList(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ExampleTxAllowListTransactor{contract: contract}, nil -} - -// NewExampleTxAllowListFilterer creates a new log filterer instance of ExampleTxAllowList, bound to a specific deployed contract. -func NewExampleTxAllowListFilterer(address common.Address, filterer bind.ContractFilterer) (*ExampleTxAllowListFilterer, error) { - contract, err := bindExampleTxAllowList(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ExampleTxAllowListFilterer{contract: contract}, nil -} - -// bindExampleTxAllowList binds a generic wrapper to an already deployed contract. -func bindExampleTxAllowList(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ExampleTxAllowListMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ExampleTxAllowList *ExampleTxAllowListRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ExampleTxAllowList.Contract.ExampleTxAllowListCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ExampleTxAllowList *ExampleTxAllowListRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.ExampleTxAllowListTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ExampleTxAllowList *ExampleTxAllowListRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.ExampleTxAllowListTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ExampleTxAllowList *ExampleTxAllowListCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ExampleTxAllowList.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ExampleTxAllowList *ExampleTxAllowListTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ExampleTxAllowList *ExampleTxAllowListTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.contract.Transact(opts, method, params...) -} - -// IsAdmin is a free data retrieval call binding the contract method 0x24d7806c. -// -// Solidity: function isAdmin(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListCaller) IsAdmin(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _ExampleTxAllowList.contract.Call(opts, &out, "isAdmin", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsAdmin is a free data retrieval call binding the contract method 0x24d7806c. -// -// Solidity: function isAdmin(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListSession) IsAdmin(addr common.Address) (bool, error) { - return _ExampleTxAllowList.Contract.IsAdmin(&_ExampleTxAllowList.CallOpts, addr) -} - -// IsAdmin is a free data retrieval call binding the contract method 0x24d7806c. -// -// Solidity: function isAdmin(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListCallerSession) IsAdmin(addr common.Address) (bool, error) { - return _ExampleTxAllowList.Contract.IsAdmin(&_ExampleTxAllowList.CallOpts, addr) -} - -// IsEnabled is a free data retrieval call binding the contract method 0x9015d371. -// -// Solidity: function isEnabled(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListCaller) IsEnabled(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _ExampleTxAllowList.contract.Call(opts, &out, "isEnabled", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsEnabled is a free data retrieval call binding the contract method 0x9015d371. -// -// Solidity: function isEnabled(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListSession) IsEnabled(addr common.Address) (bool, error) { - return _ExampleTxAllowList.Contract.IsEnabled(&_ExampleTxAllowList.CallOpts, addr) -} - -// IsEnabled is a free data retrieval call binding the contract method 0x9015d371. -// -// Solidity: function isEnabled(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListCallerSession) IsEnabled(addr common.Address) (bool, error) { - return _ExampleTxAllowList.Contract.IsEnabled(&_ExampleTxAllowList.CallOpts, addr) -} - -// IsManager is a free data retrieval call binding the contract method 0xf3ae2415. -// -// Solidity: function isManager(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListCaller) IsManager(opts *bind.CallOpts, addr common.Address) (bool, error) { - var out []interface{} - err := _ExampleTxAllowList.contract.Call(opts, &out, "isManager", addr) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsManager is a free data retrieval call binding the contract method 0xf3ae2415. -// -// Solidity: function isManager(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListSession) IsManager(addr common.Address) (bool, error) { - return _ExampleTxAllowList.Contract.IsManager(&_ExampleTxAllowList.CallOpts, addr) -} - -// IsManager is a free data retrieval call binding the contract method 0xf3ae2415. -// -// Solidity: function isManager(address addr) view returns(bool) -func (_ExampleTxAllowList *ExampleTxAllowListCallerSession) IsManager(addr common.Address) (bool, error) { - return _ExampleTxAllowList.Contract.IsManager(&_ExampleTxAllowList.CallOpts, addr) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ExampleTxAllowList *ExampleTxAllowListCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _ExampleTxAllowList.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ExampleTxAllowList *ExampleTxAllowListSession) Owner() (common.Address, error) { - return _ExampleTxAllowList.Contract.Owner(&_ExampleTxAllowList.CallOpts) -} - -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. -// -// Solidity: function owner() view returns(address) -func (_ExampleTxAllowList *ExampleTxAllowListCallerSession) Owner() (common.Address, error) { - return _ExampleTxAllowList.Contract.Owner(&_ExampleTxAllowList.CallOpts) -} - -// DeployContract is a paid mutator transaction binding the contract method 0x6cd5c39b. -// -// Solidity: function deployContract() returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) DeployContract(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "deployContract") -} - -// DeployContract is a paid mutator transaction binding the contract method 0x6cd5c39b. -// -// Solidity: function deployContract() returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) DeployContract() (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.DeployContract(&_ExampleTxAllowList.TransactOpts) -} - -// DeployContract is a paid mutator transaction binding the contract method 0x6cd5c39b. -// -// Solidity: function deployContract() returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) DeployContract() (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.DeployContract(&_ExampleTxAllowList.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) RenounceOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "renounceOwnership") -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) RenounceOwnership() (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.RenounceOwnership(&_ExampleTxAllowList.TransactOpts) -} - -// RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. -// -// Solidity: function renounceOwnership() returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) RenounceOwnership() (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.RenounceOwnership(&_ExampleTxAllowList.TransactOpts) -} - -// Revoke is a paid mutator transaction binding the contract method 0x74a8f103. -// -// Solidity: function revoke(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) Revoke(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "revoke", addr) -} - -// Revoke is a paid mutator transaction binding the contract method 0x74a8f103. -// -// Solidity: function revoke(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) Revoke(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.Revoke(&_ExampleTxAllowList.TransactOpts, addr) -} - -// Revoke is a paid mutator transaction binding the contract method 0x74a8f103. -// -// Solidity: function revoke(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) Revoke(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.Revoke(&_ExampleTxAllowList.TransactOpts, addr) -} - -// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. -// -// Solidity: function setAdmin(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) SetAdmin(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "setAdmin", addr) -} - -// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. -// -// Solidity: function setAdmin(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) SetAdmin(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.SetAdmin(&_ExampleTxAllowList.TransactOpts, addr) -} - -// SetAdmin is a paid mutator transaction binding the contract method 0x704b6c02. -// -// Solidity: function setAdmin(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) SetAdmin(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.SetAdmin(&_ExampleTxAllowList.TransactOpts, addr) -} - -// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. -// -// Solidity: function setEnabled(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) SetEnabled(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "setEnabled", addr) -} - -// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. -// -// Solidity: function setEnabled(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) SetEnabled(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.SetEnabled(&_ExampleTxAllowList.TransactOpts, addr) -} - -// SetEnabled is a paid mutator transaction binding the contract method 0x0aaf7043. -// -// Solidity: function setEnabled(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) SetEnabled(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.SetEnabled(&_ExampleTxAllowList.TransactOpts, addr) -} - -// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. -// -// Solidity: function setManager(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) SetManager(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "setManager", addr) -} - -// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. -// -// Solidity: function setManager(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) SetManager(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.SetManager(&_ExampleTxAllowList.TransactOpts, addr) -} - -// SetManager is a paid mutator transaction binding the contract method 0xd0ebdbe7. -// -// Solidity: function setManager(address addr) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) SetManager(addr common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.SetManager(&_ExampleTxAllowList.TransactOpts, addr) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactor) TransferOwnership(opts *bind.TransactOpts, newOwner common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.contract.Transact(opts, "transferOwnership", newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ExampleTxAllowList *ExampleTxAllowListSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.TransferOwnership(&_ExampleTxAllowList.TransactOpts, newOwner) -} - -// TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. -// -// Solidity: function transferOwnership(address newOwner) returns() -func (_ExampleTxAllowList *ExampleTxAllowListTransactorSession) TransferOwnership(newOwner common.Address) (*types.Transaction, error) { - return _ExampleTxAllowList.Contract.TransferOwnership(&_ExampleTxAllowList.TransactOpts, newOwner) -} - -// ExampleTxAllowListOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the ExampleTxAllowList contract. -type ExampleTxAllowListOwnershipTransferredIterator struct { - Event *ExampleTxAllowListOwnershipTransferred // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ExampleTxAllowListOwnershipTransferredIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ExampleTxAllowListOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ExampleTxAllowListOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ExampleTxAllowListOwnershipTransferredIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ExampleTxAllowListOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ExampleTxAllowListOwnershipTransferred represents a OwnershipTransferred event raised by the ExampleTxAllowList contract. -type ExampleTxAllowListOwnershipTransferred struct { - PreviousOwner common.Address - NewOwner common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterOwnershipTransferred is a free log retrieval operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ExampleTxAllowList *ExampleTxAllowListFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, previousOwner []common.Address, newOwner []common.Address) (*ExampleTxAllowListOwnershipTransferredIterator, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ExampleTxAllowList.contract.FilterLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return &ExampleTxAllowListOwnershipTransferredIterator{contract: _ExampleTxAllowList.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -// WatchOwnershipTransferred is a free log subscription operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ExampleTxAllowList *ExampleTxAllowListFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *ExampleTxAllowListOwnershipTransferred, previousOwner []common.Address, newOwner []common.Address) (event.Subscription, error) { - - var previousOwnerRule []interface{} - for _, previousOwnerItem := range previousOwner { - previousOwnerRule = append(previousOwnerRule, previousOwnerItem) - } - var newOwnerRule []interface{} - for _, newOwnerItem := range newOwner { - newOwnerRule = append(newOwnerRule, newOwnerItem) - } - - logs, sub, err := _ExampleTxAllowList.contract.WatchLogs(opts, "OwnershipTransferred", previousOwnerRule, newOwnerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ExampleTxAllowListOwnershipTransferred) - if err := _ExampleTxAllowList.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseOwnershipTransferred is a log parse operation binding the contract event 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0. -// -// Solidity: event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) -func (_ExampleTxAllowList *ExampleTxAllowListFilterer) ParseOwnershipTransferred(log types.Log) (*ExampleTxAllowListOwnershipTransferred, error) { - event := new(ExampleTxAllowListOwnershipTransferred) - if err := _ExampleTxAllowList.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/contracts/contracts/AllowList.sol b/contracts/contracts/AllowList.sol deleted file mode 100644 index 9a6a88e7b6..0000000000 --- a/contracts/contracts/AllowList.sol +++ /dev/null @@ -1,82 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "./interfaces/IAllowList.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; - -// AllowList is a base contract to use AllowList precompile capabilities. -contract AllowList is Ownable { - // Precompiled Allow List Contract Address - IAllowList private allowList; - - uint256 constant STATUS_NONE = 0; - uint256 constant STATUS_ENABLED = 1; - uint256 constant STATUS_ADMIN = 2; - uint256 constant STATUS_MANAGER = 3; - - enum Role { - None, - Enabled, - Admin, - Manager - } - - constructor(address precompileAddr) Ownable(msg.sender) { - allowList = IAllowList(precompileAddr); - } - - modifier onlyEnabled() { - require(isEnabled(msg.sender), "not enabled"); - _; - } - - function isAdmin(address addr) public view returns (bool) { - uint256 result = allowList.readAllowList(addr); - return result == STATUS_ADMIN; - } - - function isManager(address addr) public view returns (bool) { - uint256 result = allowList.readAllowList(addr); - return result == STATUS_MANAGER; - } - - function isEnabled(address addr) public view returns (bool) { - uint256 result = allowList.readAllowList(addr); - // if address is ENABLED or ADMIN or MANAGER it can deploy - // in other words, if it's not NONE it can deploy. - return result != STATUS_NONE; - } - - function setAdmin(address addr) public virtual onlyOwner { - _setAdmin(addr); - } - - function _setAdmin(address addr) private { - allowList.setAdmin(addr); - } - - function setManager(address addr) public virtual onlyOwner { - _setManager(addr); - } - - function _setManager(address addr) private { - allowList.setManager(addr); - } - - function setEnabled(address addr) public virtual onlyOwner { - _setEnabled(addr); - } - - function _setEnabled(address addr) private { - allowList.setEnabled(addr); - } - - function revoke(address addr) public virtual onlyOwner { - _revoke(addr); - } - - function _revoke(address addr) private { - require(msg.sender != addr, "cannot revoke own role"); - allowList.setNone(addr); - } -} diff --git a/contracts/contracts/interfaces/IAllowList.sol b/contracts/contracts/interfaces/IAllowList.sol deleted file mode 100644 index 8b525b12e1..0000000000 --- a/contracts/contracts/interfaces/IAllowList.sol +++ /dev/null @@ -1,21 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -interface IAllowList { - event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole); - - // Set [addr] to have the admin role over the precompile contract. - function setAdmin(address addr) external; - - // Set [addr] to be enabled on the precompile contract. - function setEnabled(address addr) external; - - // Set [addr] to have the manager role over the precompile contract. - function setManager(address addr) external; - - // Set [addr] to have no role for the precompile contract. - function setNone(address addr) external; - - // Read the status of [addr]. - function readAllowList(address addr) external view returns (uint256 role); -} diff --git a/contracts/contracts/test/AllowListTest.sol b/contracts/contracts/test/AllowListTest.sol deleted file mode 100644 index 73a752bba1..0000000000 --- a/contracts/contracts/test/AllowListTest.sol +++ /dev/null @@ -1,11 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "../AllowList.sol"; -import "ds-test/src/test.sol"; - -contract AllowListTest is DSTest { - function assertRole(uint result, AllowList.Role role) internal { - assertEq(result, uint(role)); - } -} diff --git a/contracts/index.ts b/contracts/index.ts deleted file mode 100644 index fb69b71c8a..0000000000 --- a/contracts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { test } from './test/utils'; diff --git a/contracts/tasks.ts b/contracts/tasks.ts deleted file mode 100644 index 9abfbdf442..0000000000 --- a/contracts/tasks.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { task } from "hardhat/config" - -const BLACKHOLE_ADDRESS = "0x0100000000000000000000000000000000000000" -const CONTRACT_ALLOW_LIST_ADDRESS = "0x0200000000000000000000000000000000000000" -const MINT_ADDRESS = "0x0200000000000000000000000000000000000001" -const TX_ALLOW_LIST_ADDRESS = "0x0200000000000000000000000000000000000002" -const FEE_MANAGER_ADDRESS = "0x0200000000000000000000000000000000000003" -const REWARD_MANAGER_ADDRESS = "0x0200000000000000000000000000000000000004" - - -const ROLES = { - 0: "None", - 1: "Enabled", - 2: "Admin", -} - -const getRole = async (allowList, address) => { - const role = await allowList.readAllowList(address) - console.log(`${address} has role: ${ROLES[role.toNumber()]}`) -} - -task("accounts", "Prints the list of accounts", async (args, hre): Promise => { - const accounts = await hre.ethers.getSigners() - accounts.forEach((account): void => { - console.log(account.address) - }) -}) - -task("balances", "Prints the list of account balances", async (args, hre): Promise => { - const accounts = await hre.ethers.getSigners() - for (const account of accounts) { - const balance = await hre.ethers.provider.getBalance( - account.address - ) - console.log(`${account.address} has balance ${balance.toString()}`) - } -}) - - -task("balance", "get the balance") - .addParam("address", "the address you want to know balance of") - .setAction(async (args, hre) => { - const balance = await hre.ethers.provider.getBalance(args.address) - const balanceInCoin = hre.ethers.formatEther(balance) - console.log(`balance: ${balanceInCoin} Coin`) - }) - -// npx hardhat rewardManager:currentRewardAddress --network local -task("rewardManager:currentRewardAddress", "Gets the current configured rewarding address") - .setAction(async (_, hre) => { - const rewardManager = await hre.ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS) - const areFeeRecipientsAllowed = await rewardManager.areFeeRecipientsAllowed() - const result = await rewardManager.currentRewardAddress() - if (areFeeRecipientsAllowed) { - console.log("Custom Fee Recipients are allowed. (%s)", result) - } else { - console.log(`Current reward address is ${result}`) - } - }) - -// npx hardhat rewardManager:areFeeRecipientsAllowed --network local -task("rewardManager:areFeeRecipientsAllowed", "Gets whether the fee recipients are allowed to receive rewards") - .setAction(async (_, hre) => { - const rewardManager = await hre.ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS) - const result = await rewardManager.areFeeRecipientsAllowed() - console.log(result) - }) - -// npx hardhat rewardManager:setRewardAddress --network local --address [address] -task("rewardManager:setRewardAddress", "Sets a new reward address") - .addParam("address", "the address that will receive rewards") - .setAction(async (args, hre) => { - const rewardManager = await hre.ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS) - const result = await rewardManager.setRewardAddress(args.address) - console.log(result) - }) - -// npx hardhat rewardManager:allowFeeRecipients --network local -task("rewardManager:allowFeeRecipients", "Allows custom fee recipients to receive rewards") - .setAction(async (_, hre) => { - const rewardManager = await hre.ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS) - const result = await rewardManager.allowFeeRecipients() - console.log(result) - }) - -// npx hardhat rewardManager:disableRewards --network local -task("rewardManager:disableRewards", "Disables all rewards, and starts burning fees.") - .setAction(async (_, hre) => { - const rewardManager = await hre.ethers.getContractAt("IRewardManager", REWARD_MANAGER_ADDRESS) - const result = await rewardManager.disableRewards() - console.log(result) - }) \ No newline at end of file diff --git a/contracts/test/utils.ts b/contracts/test/utils.ts deleted file mode 100644 index aa85b66733..0000000000 --- a/contracts/test/utils.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { ethers } from "hardhat" -import { Overrides } from "ethers" -import assert from "assert" - -/* - * - * The `test` function is a wrapper around Mocha's `it` function. It provides a normalized framework for running the - * majority of your test assertions inside of a smart-contract, using `DS-Test`. - * The API can be used as follows (all of the examples are equivalent): - * ```ts - * test("", "") - * test("", [""]) - * test("", { method: "", overrides: {}, shouldFail: false, debug: false }) - * test("", [{ method: "", overrides: {}, shouldFail: false, debug: false }]) - * test("", [{ method: "", shouldFail: false, debug: false }], {}) - * ``` - * Many contract functions can be called as a part of the same test: - * ```ts - * test("", ["", "", ""]) - * ``` - * Individual test functions can describe their own overrides with the `overrides` property. - * If an object is passed in as the third argument to `test`, it will be used as the default overrides for all test - * functions. - * The following are equivalent: - * ```ts - * test("", [{ method: "", overrides: { from: "0x123" } }]) - * test("", [{ method: "" }], { from: "0x123" }) - * ``` - * In the above cases, the `from` override must be a signer. - * The `shouldFail` property can be used to indicate that the test function should fail. This should be used sparingly - * as it is not possible to match on the failure reason. - * Furthermore, the `debug` property can be used to print any thrown errors when attempting to - * send a transaction or while waiting for the transaction to be confirmed (the transaction is the smart contract call). - * `debug` will also cause any parseable event logs to be printed that start with the `log_` prefix. - * `DSTest` contracts have several options for emitting `log_` events. - * - */ - -// Below are the types that help define all the different ways to call `test` -type FnNameOrObject = string | string[] | MethodObject | MethodObject[] - -// Limit `from` property to be a `string` instead of `string | Promise` -type CallOverrides = Overrides & { from?: string } - -type MethodObject = { method: string, debug?: boolean, overrides?: CallOverrides, shouldFail?: boolean } - -// This type is after all default values have been applied -type MethodWithDebugAndOverrides = MethodObject & { debug: boolean, overrides: CallOverrides, shouldFail: boolean } - -// `test` is used very similarly to `it` from Mocha -export const test = (name, fnNameOrObject, overrides = {}) => it(name, buildTestFn(fnNameOrObject, overrides)) -// `test.only` is used very similarly to `it.only` from Mocha, it will isolate all tests marked with `test.only` -test.only = (name, fnNameOrObject, overrides = {}) => it.only(name, buildTestFn(fnNameOrObject, overrides)) -// `test.debug` is used to apply `debug: true` to all DSTest contract method calls in the test -test.debug = (name, fnNameOrObject, overrides = {}) => it.only(name, buildTestFn(fnNameOrObject, overrides, true)) -// `test.skip` is used very similarly to `it.skip` from Mocha, it will skip all tests marked with `test.skip` -test.skip = (name, fnNameOrObject, overrides = {}) => it.skip(name, buildTestFn(fnNameOrObject, overrides)) - -// `buildTestFn` is a higher-order function. It returns a function that can be used as the test function for `it` -const buildTestFn = (fnNameOrObject: FnNameOrObject, overrides = {}, debug = false) => { - // normalize the input to an array of objects - const fnObjects: MethodWithDebugAndOverrides[] = (Array.isArray(fnNameOrObject) ? fnNameOrObject : [fnNameOrObject]).map(fnNameOrObject => { - fnNameOrObject = typeof fnNameOrObject === 'string' ? { method: fnNameOrObject } : fnNameOrObject - // assign all default values and overrides - fnNameOrObject.overrides = Object.assign({}, overrides, fnNameOrObject.overrides ?? {}) - fnNameOrObject.debug = fnNameOrObject.debug ?? debug - fnNameOrObject.shouldFail = fnNameOrObject.shouldFail ?? false - - return fnNameOrObject as MethodWithDebugAndOverrides - }) - - // only `step_` prefixed functions can be called on the `DSTest` contracts to clearly separate tests and helpers - assert(fnObjects.every(({ method }) => method.startsWith('step_')), "Solidity test functions must be prefixed with 'step_'") - - // return the test function that will be used by `it` - // this function must be defined with the `function` keyword so that `this` is bound to the Mocha context - return async function () { - // `Array.prototype.reduce` is used here to ensure that the test functions are called in order. - // Each test function waits for its predecessor to complete before starting - return fnObjects.reduce((p: Promise, fn) => p.then(async () => { - const contract = fn.overrides.from - ? this.testContract.connect(await ethers.getSigner(fn.overrides.from)) - : this.testContract - const tx = await contract[fn.method](fn.overrides).catch(err => { - if (fn.shouldFail) { - if (fn.debug){ - console.error(`smart contract call failed with error:\n${err}\n`) - } - - return { failed: true } - } - - console.error("smart contract call failed with error:", err) - throw err - }) - - // no more assertions necessary if the method-call should fail and did fail - if (tx.failed && fn.shouldFail) return - - const txReceipt = await tx.wait().catch(err => { - if (fn.debug) console.error(`tx failed with error:\n${err}\n`) - return err.receipt - }) - - // `txReceipt.status` will be `0` if the transaction failed. - // `contract.failed` will return `true` if any of the `DSTest` assertions failed. - const failed = txReceipt.status === 0 ? true : await contract.failed.staticCall() - if (fn.debug || failed) { - console.log('') - - if (!txReceipt.events) console.warn('WARNING: No parseable events found in tx-receipt\n') - - // If `DSTest` assertions failed, the contract will emit logs describing the assertion failure(s). - txReceipt - .events - ?.filter(event => fn.debug || event.event?.startsWith('log')) - .map(event => event.args?.forEach(arg => console.log(arg))) - - console.log('') - } - - assert(!failed, `${fn.method} failed`) - }), Promise.resolve()) - } -} - -export const Roles = { - None: 0, - Enabled: 1, - Admin: 2, - Manager: 3, -} diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index 6253da0980..3d1c7b5c23 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -7,7 +7,6 @@ package solidity import ( "context" "fmt" - "time" "github.com/ava-labs/subnet-evm/tests/utils" @@ -27,30 +26,6 @@ func RegisterAsyncTests() { if len(genesisFiles) == 0 { ginkgo.AbortSuite("No genesis files found") } - subnetsSuite := utils.CreateSubnetsSuite(genesisFiles) - - timeout := 3 * time.Minute - _ = ginkgo.Describe("[Asynchronized Precompile Tests]", func() { - // Register the ping test first - utils.RegisterPingTest() - - // Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/) - // to use to launch the subnet and the name of the TS test file to run on the subnet (in ./contracts/tests/) - - // ADD YOUR PRECOMPILE HERE - /* - ginkgo.It("your precompile", ginkgo.Label("Precompile"), ginkgo.Label("YourPrecompile"), func() { - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - - // Specify the name shared by the genesis file in ./tests/precompile/genesis/{your_precompile}.json - // and the test file in ./contracts/tests/{your_precompile}.ts - // If you want to use a different test command and genesis path than the defaults, you can - // use the utils.RunTestCMD. See utils.RunDefaultHardhatTests for an example. - subnetsSuite.RunHardhatTests(ctx, "your_precompile") - }) - */ - }) } // Default parameters are: From 5e77010f82a7cef1d606758f33769f7dae54e554 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 16:34:35 -0500 Subject: [PATCH 13/73] test: use new structure --- .../allowlisttest/test_allowlist_events.go | 2 - .../contracts/rewardmanager/simulated_test.go | 153 ++++++++---------- 2 files changed, 69 insertions(+), 86 deletions(-) diff --git a/precompile/allowlist/allowlisttest/test_allowlist_events.go b/precompile/allowlist/allowlisttest/test_allowlist_events.go index 178821bc4b..ea68cda8ad 100644 --- a/precompile/allowlist/allowlisttest/test_allowlist_events.go +++ b/precompile/allowlist/allowlisttest/test_allowlist_events.go @@ -133,7 +133,6 @@ func RunAllowListEventTests( require.NoError(err) defer iter.Close() - // Verify event fields match expected values for _, expectedEvent := range tc.expectedEvents { require.True(iter.Next(), "expected to find RoleSet event") event := iter.Event @@ -143,7 +142,6 @@ func RunAllowListEventTests( require.Zero(expectedEvent.OldRole.Cmp(event.OldRole), "oldRole mismatch") } - // Verify there are no more events require.False(iter.Next(), "expected no more RoleSet events") require.NoError(iter.Error()) }) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index d26bc9dd51..f466afc327 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -4,11 +4,9 @@ package rewardmanager_test import ( - "math/big" "testing" "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" @@ -16,7 +14,6 @@ import ( "github.com/ava-labs/subnet-evm/constants" "github.com/ava-labs/subnet-evm/core" "github.com/ava-labs/subnet-evm/params" - "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/allowlist/allowlisttest" @@ -44,24 +41,6 @@ func TestMain(m *testing.M) { m.Run() } -func newBackendWithRewardManager(t *testing.T) *sim.Backend { - t.Helper() - chainCfg := params.Copy(params.TestChainConfig) - // Enable RewardManager at genesis with admin set to adminAddress. - params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ - rewardmanager.ConfigKey: rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), - } - return sim.NewBackend( - types.GenesisAlloc{ - adminAddress: {Balance: big.NewInt(1000000000000000000)}, - unprivilegedAddress: {Balance: big.NewInt(1000000000000000000)}, - }, - sim.WithChainConfig(&chainCfg), - ) -} - -// Helper functions - func deployRewardManagerTest(t *testing.T, b *sim.Backend, auth *bind.TransactOpts) (common.Address, *rewardmanagerbindings.RewardManagerTest) { t.Helper() addr, tx, contract, err := rewardmanagerbindings.DeployRewardManagerTest(auth, b.Client(), rewardmanager.ContractAddress) @@ -240,7 +219,7 @@ func TestRewardManager(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := newBackendWithRewardManager(t) + backend := testutils.NewBackendWithPrecompile(t, rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), adminAddress, unprivilegedAddress) defer backend.Close() rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) @@ -257,80 +236,86 @@ func TestIRewardManager_Events(t *testing.T) { testKey, _ := crypto.GenerateKey() testAddress := crypto.PubkeyToAddress(testKey.PublicKey) - t.Run("should emit RewardAddressChanged event", func(t *testing.T) { - backend := newBackendWithRewardManager(t) - defer backend.Close() - - rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) - require.NoError(t, err) - - tx, err := rewardManager.SetRewardAddress(admin, testAddress) - require.NoError(t, err) - testutils.WaitReceiptSuccessful(t, backend, tx) - - iter, err := rewardManager.FilterRewardAddressChanged(nil, nil, nil, nil) - require.NoError(t, err) - defer iter.Close() - - require.True(t, iter.Next(), "expected to find RewardAddressChanged event") - event := iter.Event - require.Equal(t, adminAddress, event.Sender, "sender mismatch") - require.Equal(t, constants.BlackholeAddr, event.OldRewardAddress, "old reward address mismatch") - require.Equal(t, testAddress, event.NewRewardAddress, "new reward address mismatch") + type testCase struct { + name string + test func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) + } - require.False(t, iter.Next(), "expected no more events") - require.NoError(t, iter.Error()) - }) + testCases := []testCase{ + { + name: "should emit RewardAddressChanged event", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + tx, err := rewardManager.SetRewardAddress(admin, testAddress) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) - t.Run("should emit FeeRecipientsAllowed event", func(t *testing.T) { - backend := newBackendWithRewardManager(t) - defer backend.Close() + iter, err := rewardManager.FilterRewardAddressChanged(nil, nil, nil, nil) + require.NoError(t, err) + defer iter.Close() - rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) - require.NoError(t, err) + require.True(t, iter.Next(), "expected to find RewardAddressChanged event") + event := iter.Event + require.Equal(t, adminAddress, event.Sender) + require.Equal(t, constants.BlackholeAddr, event.OldRewardAddress) + require.Equal(t, testAddress, event.NewRewardAddress) - tx, err := rewardManager.AllowFeeRecipients(admin) - require.NoError(t, err) - testutils.WaitReceiptSuccessful(t, backend, tx) + require.False(t, iter.Next(), "expected no more events") + require.NoError(t, iter.Error()) + }, + }, + { + name: "should emit FeeRecipientsAllowed event", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + tx, err := rewardManager.AllowFeeRecipients(admin) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) - iter, err := rewardManager.FilterFeeRecipientsAllowed(nil, nil) - require.NoError(t, err) - defer iter.Close() + iter, err := rewardManager.FilterFeeRecipientsAllowed(nil, nil) + require.NoError(t, err) + defer iter.Close() - require.True(t, iter.Next(), "expected to find FeeRecipientsAllowed event") - event := iter.Event - require.Equal(t, adminAddress, event.Sender, "sender mismatch") + require.True(t, iter.Next(), "expected to find FeeRecipientsAllowed event") + require.Equal(t, adminAddress, iter.Event.Sender) - require.False(t, iter.Next(), "expected no more events") - require.NoError(t, iter.Error()) - }) + require.False(t, iter.Next(), "expected no more events") + require.NoError(t, iter.Error()) + }, + }, + { + name: "should emit RewardsDisabled event", + test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { + tx, err := rewardManager.DisableRewards(admin) + require.NoError(t, err) + testutils.WaitReceiptSuccessful(t, backend, tx) - t.Run("should emit RewardsDisabled event", func(t *testing.T) { - backend := newBackendWithRewardManager(t) - defer backend.Close() + iter, err := rewardManager.FilterRewardsDisabled(nil, nil) + require.NoError(t, err) + defer iter.Close() - rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) - require.NoError(t, err) + require.True(t, iter.Next(), "expected to find RewardsDisabled event") + require.Equal(t, adminAddress, iter.Event.Sender) - tx, err := rewardManager.DisableRewards(admin) - require.NoError(t, err) - testutils.WaitReceiptSuccessful(t, backend, tx) + require.False(t, iter.Next(), "expected no more events") + require.NoError(t, iter.Error()) + }, + }, + } - iter, err := rewardManager.FilterRewardsDisabled(nil, nil) - require.NoError(t, err) - defer iter.Close() + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + backend := testutils.NewBackendWithPrecompile(t, rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), adminAddress, unprivilegedAddress) + defer backend.Close() - require.True(t, iter.Next(), "expected to find RewardsDisabled event") - event := iter.Event - require.Equal(t, adminAddress, event.Sender, "sender mismatch") + rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) + require.NoError(t, err) - require.False(t, iter.Next(), "expected no more events") - require.NoError(t, iter.Error()) - }) + tc.test(t, backend, rewardManager) + }) + } } -// TODO(jonathanoppenheimer): uncomment this once RunAllowListEventTests() is merged into main -// func TestIAllowList_Events(t *testing.T) { -// admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) -// allowlisttest.RunAllowListEventTests(t, newBackendWithRewardManager, rewardmanager.ContractAddress, admin, adminAddress) -// } +func TestIAllowList_Events(t *testing.T) { + precompileCfg := rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil) + admin := testutils.NewAuth(t, adminKey, params.TestChainConfig.ChainID) + allowlisttest.RunAllowListEventTests(t, precompileCfg, rewardmanager.ContractAddress, admin, adminAddress) +} From a135782acaa47e5ae02c3fdcb5572e2b5d185f46 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 16:38:44 -0500 Subject: [PATCH 14/73] chore: delete vestigial CI --- .github/workflows/ci.yml | 29 ----------------------------- Taskfile.yml | 11 ----------- scripts/run_ginkgo_precompile.sh | 22 ---------------------- 3 files changed, 62 deletions(-) delete mode 100755 scripts/run_ginkgo_precompile.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5737d55c9c..bebf39174d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,35 +70,6 @@ jobs: TIMEOUT: ${{ env.TIMEOUT }} - run: ./scripts/run_task.sh coverage - e2e_precompile: - name: e2e precompile tests - runs-on: ubuntu-latest - steps: - - name: Git checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: recursive - - name: Set up solc - uses: ARR4N/setup-solc@v0.2.0 - with: - versions: "0.8.30" - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: "20.13" - - name: Setup Contracts - run: ./scripts/run_task.sh setup-contracts - - name: Run E2E Precompile Tests - run: ./scripts/run_task.sh test-e2e-precompile-ci - - name: Upload Artifact - if: always() - uses: actions/upload-artifact@v4 - with: - name: subnet-evm-e2e-logs-precompile - path: /tmp/e2e-test/precompile-data - retention-days: 5 - e2e_warp: name: e2e warp tests runs-on: ubuntu-latest diff --git a/Taskfile.yml b/Taskfile.yml index de8ca8c54c..ea9d652748 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -187,17 +187,6 @@ tasks: - task: build - task: test-e2e-load - test-e2e-precompile: - desc: Run end-to-end precompile tests using Ginkgo with parallel execution - cmd: bash -x ./scripts/run_ginkgo_precompile.sh # ci.yml - - test-e2e-precompile-ci: # consolidated test-e2e-precompile - desc: Run E2E precompile tests with CI setup - cmds: - - task: install-avalanchego-release - - task: build - - task: test-e2e-precompile - test-e2e-warp: desc: Run end-to-end warp tests using Ginkgo test framework cmd: bash -x ./scripts/run_ginkgo_warp.sh # ci.yml diff --git a/scripts/run_ginkgo_precompile.sh b/scripts/run_ginkgo_precompile.sh deleted file mode 100755 index 01315ffbe6..0000000000 --- a/scripts/run_ginkgo_precompile.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -e - -# This script assumes that an AvalancheGo and Subnet-EVM binaries are available in the standard location -# within the $GOPATH -# The AvalancheGo and PluginDir paths can be specified via the environment variables used in ./scripts/run.sh. - -SUBNET_EVM_PATH=$( - cd "$(dirname "${BASH_SOURCE[0]}")" - cd .. && pwd -) - -source "$SUBNET_EVM_PATH"/scripts/constants.sh - -TEST_SOURCE_ROOT=$(pwd) - -# By default, it runs all e2e test cases! -# Use "--ginkgo.skip" to skip tests. -# Use "--ginkgo.focus" to select tests. -TEST_SOURCE_ROOT="$TEST_SOURCE_ROOT" "${SUBNET_EVM_PATH}"/bin/ginkgo run -procs=5 tests/precompile \ - --ginkgo.vv \ - --ginkgo.label-filter="${GINKGO_LABEL_FILTER:-""}" From a7ea83ea343db8822245a0fa142e5173bb19fdf6 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 16:39:29 -0500 Subject: [PATCH 15/73] chore: unused file --- scripts/run_ginkgo.sh | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100755 scripts/run_ginkgo.sh diff --git a/scripts/run_ginkgo.sh b/scripts/run_ginkgo.sh deleted file mode 100755 index 4b27a2906e..0000000000 --- a/scripts/run_ginkgo.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -REPO_ROOT=$( - cd "$(dirname "${BASH_SOURCE[0]}")" - cd .. && pwd -) -cd "${REPO_ROOT}" - -go tool ginkgo "${@}" From 997ce0fd9803c053e3a54f50e9492e0fb3adab3b Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 16:51:45 -0500 Subject: [PATCH 16/73] test: restore task.ts --- contracts/tasks.ts | 28 ++++++++++++++++++++ tests/precompile/precompile_test.go | 22 ---------------- tests/precompile/solidity/suites.go | 41 ----------------------------- 3 files changed, 28 insertions(+), 63 deletions(-) create mode 100644 contracts/tasks.ts delete mode 100644 tests/precompile/precompile_test.go delete mode 100644 tests/precompile/solidity/suites.go diff --git a/contracts/tasks.ts b/contracts/tasks.ts new file mode 100644 index 0000000000..605b885ca1 --- /dev/null +++ b/contracts/tasks.ts @@ -0,0 +1,28 @@ +import { task } from "hardhat/config" + + +task("accounts", "Prints the list of accounts", async (args, hre): Promise => { + const accounts = await hre.ethers.getSigners() + accounts.forEach((account): void => { + console.log(account.address) + }) +}) + +task("balances", "Prints the list of account balances", async (args, hre): Promise => { + const accounts = await hre.ethers.getSigners() + for (const account of accounts) { + const balance = await hre.ethers.provider.getBalance( + account.address + ) + console.log(`${account.address} has balance ${balance.toString()}`) + } +}) + + +task("balance", "get the balance") + .addParam("address", "the address you want to know balance of") + .setAction(async (args, hre) => { + const balance = await hre.ethers.provider.getBalance(args.address) + const balanceInCoin = hre.ethers.formatEther(balance) + console.log(`balance: ${balanceInCoin} Coin`) + }) diff --git a/tests/precompile/precompile_test.go b/tests/precompile/precompile_test.go deleted file mode 100644 index a4bd1dd5e9..0000000000 --- a/tests/precompile/precompile_test.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -package precompile - -import ( - "os" - "testing" - - // Import the solidity package, so that ginkgo maps out the tests declared within the package - "github.com/ava-labs/subnet-evm/tests/precompile/solidity" - - ginkgo "github.com/onsi/ginkgo/v2" -) - -func TestE2E(t *testing.T) { - if basePath := os.Getenv("TEST_SOURCE_ROOT"); basePath != "" { - t.Chdir(basePath) - } - solidity.RegisterAsyncTests() - ginkgo.RunSpecs(t, "subnet-evm precompile ginkgo test suite") -} diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go deleted file mode 100644 index 3d1c7b5c23..0000000000 --- a/tests/precompile/solidity/suites.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -// Implements solidity tests. -package solidity - -import ( - "context" - "fmt" - - "github.com/ava-labs/subnet-evm/tests/utils" - - ginkgo "github.com/onsi/ginkgo/v2" -) - -// Registers the Asynchronized Precompile Tests -// Before running the tests, this function creates all subnets given in the genesis files -// and then runs the hardhat tests for each one asynchronously if called with `ginkgo run -procs=`. -func RegisterAsyncTests() { - // Tests here assumes that the genesis files are in ./tests/precompile/genesis/ - // with the name {precompile_name}.json - genesisFiles, err := utils.GetFilesAndAliases("./tests/precompile/genesis/*.json") - if err != nil { - ginkgo.AbortSuite("Failed to get genesis files: " + err.Error()) - } - if len(genesisFiles) == 0 { - ginkgo.AbortSuite("No genesis files found") - } -} - -// Default parameters are: -// -// 1. Hardhat contract environment is located at ./contracts -// 2. Hardhat test file is located at ./contracts/test/.ts -// 3. npx is available in the ./contracts directory -func runDefaultHardhatTests(ctx context.Context, blockchainID, testName string) { - cmdPath := "./contracts" - // test path is relative to the cmd path - testPath := fmt.Sprintf("./test/%s.ts", testName) - utils.RunHardhatTests(ctx, blockchainID, cmdPath, testPath) -} From c82ccd76ff4fa37b42687765b8cd093262f5911e Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 17:01:24 -0500 Subject: [PATCH 17/73] fix: restore run_ginkgo.sh --- precompile/contracts/rewardmanager/simulated_test.go | 3 ++- scripts/run_ginkgo.sh | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 scripts/run_ginkgo.sh diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index f466afc327..9d6ffc3dc7 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/vm" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" @@ -80,7 +81,7 @@ func TestRewardManager(t *testing.T) { allowlisttest.VerifyRole(t, rewardManager, testContractAddr, allowlist.NoRole) _, err := testContract.SetRewardAddress(admin, testContractAddr) - require.ErrorContains(t, err, "execution reverted") + require.ErrorContains(t, err, vm.ErrExecutionReverted.Error()) //nolint:forbidigo // upstream error wrapped as string }, }, { diff --git a/scripts/run_ginkgo.sh b/scripts/run_ginkgo.sh new file mode 100755 index 0000000000..8b92b9c565 --- /dev/null +++ b/scripts/run_ginkgo.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -euo pipefail + +REPO_ROOT=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) +cd "${REPO_ROOT}" + +go tool ginkgo "${@}" + From 8540c62d77f8bab2e0d6c400974b2af1b9a71df4 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 17:20:25 -0500 Subject: [PATCH 18/73] chore: regenerate bindings --- .../allowlisttest/bindings/gen_allowlisttest_binding.go | 2 +- .../feemanagertest/bindings/gen_feemanagertest_binding.go | 2 +- .../nativemintertest/bindings/gen_nativemintertest_binding.go | 2 +- .../rewardmanager/rewardmanagertest/bindings/compile.go | 2 +- .../rewardmanagertest/bindings/gen_rewardmanagertest_binding.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go index 4ce13be5dd..c723bb1d4c 100644 --- a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go +++ b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go @@ -32,7 +32,7 @@ var ( // AllowListTestMetaData contains all meta data concerning the AllowListTest contract. var AllowListTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220a6f35569427acc58ad5367cdacdafc7cbf00ed36744b876fba3bd8433689c4a564736f6c634300081e0033a2646970667358221220b9610a9e66cd5a3a7c0ccc575d7228dff9f3846ffc78cf4eccd34dd152f9297664736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220101ecbafa703de68466fcefd77409333adbc67ccb8c23001c8d3577ceeaea00c64736f6c634300081e0033a2646970667358221220200b29b9e9e528cae0d288329d2bf9a74c22ab9126627951908043f2145940ed64736f6c634300081e0033", } // AllowListTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go index bf39c61e76..8027b39e63 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go @@ -32,7 +32,7 @@ var ( // FeeManagerTestMetaData contains all meta data concerning the FeeManagerTest contract. var FeeManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getFeeConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeeConfigLastChangedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"name\":\"setFeeConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea26469706673582212202589a5e482d11e8833ad4feb162fb81f20fc80dedb5b2e63ec163cabd71ae43264736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220d8299474e787e7eec716788852f61e293bf40722aa9a1bc325a5e43fd1abccae64736f6c634300081e0033", } // FeeManagerTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index 696d206166..1026238eb2 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea264697066735822122022a495ab74b25db78e2d373ef8499eee646e53fb4eb515ac693575252359c1ae64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220a4a1e35af5b1b1cbbe1061be14369b1fd1f5731c7cea7ac6eab6ac9abafdc4c464736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go index 4658b7ac52..c0c4821bbc 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go @@ -4,7 +4,7 @@ package bindings // Step 1: Compile Solidity contracts to generate ABI and bin files -//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../../.. contracts/=contracts/ precompile/=precompile/ --evm-version cancun RewardManagerTest.sol IRewardManager.sol +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../.. precompile/=precompile/ --evm-version cancun RewardManagerTest.sol IRewardManager.sol // Step 2: Generate Go bindings from the compiled artifacts //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IRewardManager --abi artifacts/IRewardManager.abi --bin artifacts/IRewardManager.bin --out gen_irewardmanager_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type RewardManagerTest --abi artifacts/RewardManagerTest.abi --bin artifacts/RewardManagerTest.bin --out gen_rewardmanagertest_binding.go diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go index 734068cb00..571efa965a 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -32,7 +32,7 @@ var ( // RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. var RewardManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea26469706673582212203c681ed5976eae17a33bf0795d671642b2e725abda45c61d05839f7f2fa7c53c64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220d7d7371612dbee7d8c25ef71706385ba65b29518f601aa8fce591bc668a0f79764736f6c634300081e0033", } // RewardManagerTestABI is the input ABI used to generate the binding from. From 63d4aaad9231a4a54a569a4f9006815369ea5177 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 17:31:01 -0500 Subject: [PATCH 19/73] chore: reduce diff --- scripts/run_ginkgo.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/run_ginkgo.sh b/scripts/run_ginkgo.sh index 8b92b9c565..4b27a2906e 100755 --- a/scripts/run_ginkgo.sh +++ b/scripts/run_ginkgo.sh @@ -9,4 +9,3 @@ REPO_ROOT=$( cd "${REPO_ROOT}" go tool ginkgo "${@}" - From 37a9e0d668781a76e1a0e39b1581c3381d1ca17b Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 17:38:08 -0500 Subject: [PATCH 20/73] chore: format --- .../bindings/INativeMinter.sol | 10 ++++++--- .../bindings/NativeMinterTest.sol | 21 +++++++++---------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol b/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol index 7fd63a55c9..fcb917b672 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol @@ -3,7 +3,11 @@ pragma solidity ^0.8.24; import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; interface INativeMinter is IAllowList { - event NativeCoinMinted(address indexed sender, address indexed recipient, uint256 amount); - // Mint [amount] number of native coins and send to [addr] - function mintNativeCoin(address addr, uint256 amount) external; + event NativeCoinMinted( + address indexed sender, + address indexed recipient, + uint256 amount + ); + // Mint [amount] number of native coins and send to [addr] + function mintNativeCoin(address addr, uint256 amount) external; } diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol b/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol index 7220cf35b4..f108f043ae 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol @@ -4,18 +4,17 @@ pragma solidity ^0.8.24; import "./INativeMinter.sol"; contract NativeMinterTest { - INativeMinter private nativeMinter; + INativeMinter private nativeMinter; - constructor(address nativeMinterPrecompile) { - nativeMinter = INativeMinter(nativeMinterPrecompile); - } + constructor(address nativeMinterPrecompile) { + nativeMinter = INativeMinter(nativeMinterPrecompile); + } - // Calls the mintNativeCoin function on the precompile - function mintNativeCoin(address addr, uint256 amount) external { - nativeMinter.mintNativeCoin(addr, amount); - } + // Calls the mintNativeCoin function on the precompile + function mintNativeCoin(address addr, uint256 amount) external { + nativeMinter.mintNativeCoin(addr, amount); + } - // Allows this contract to receive native coins - receive() external payable {} + // Allows this contract to receive native coins + receive() external payable {} } - From 284c1fc9c48c3fcc25b10686c2e3f42145fab834 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 4 Dec 2025 17:42:37 -0500 Subject: [PATCH 21/73] chore: regenerate bindings --- .../nativemintertest/bindings/gen_nativemintertest_binding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index 1026238eb2..3424da268d 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220a4a1e35af5b1b1cbbe1061be14369b1fd1f5731c7cea7ac6eab6ac9abafdc4c464736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220c643962218d1e38fb216eed32be0b372f921a26103886839dc3efb697c60c11264736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. From 748ca1cf98bcb8c5bccb160db5b70e7006314ed1 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 10:11:24 -0500 Subject: [PATCH 22/73] Update IAllowList.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- precompile/allowlist/allowlisttest/bindings/IAllowList.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol index 80d2f2e6e8..2e031d0bf1 100644 --- a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol +++ b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol @@ -21,6 +21,6 @@ interface IAllowList { // Set [addr] to have no role for the precompile contract. function setNone(address addr) external; - // Read the status os [addr]. + // Read the status of [addr]. function readAllowList(address addr) external view returns (uint256 role); } From d7f590e10386229e3da4fb7f08b038d17ac4bae5 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 11:20:45 -0500 Subject: [PATCH 23/73] docs: add comment explaining import replace --- precompile/allowlist/allowlisttest/bindings/compile.go | 1 + .../contracts/feemanager/feemanagertest/bindings/compile.go | 1 + .../contracts/nativeminter/nativemintertest/bindings/compile.go | 1 + .../rewardmanager/rewardmanagertest/bindings/compile.go | 1 + 4 files changed, 4 insertions(+) diff --git a/precompile/allowlist/allowlisttest/bindings/compile.go b/precompile/allowlist/allowlisttest/bindings/compile.go index abdadb4e86..3df2a2717e 100644 --- a/precompile/allowlist/allowlisttest/bindings/compile.go +++ b/precompile/allowlist/allowlisttest/bindings/compile.go @@ -9,4 +9,5 @@ package bindings //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IAllowList --abi artifacts/IAllowList.abi --bin artifacts/IAllowList.bin --out gen_allowlist_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type AllowListTest --abi artifacts/AllowListTest.abi --bin artifacts/AllowListTest.bin --out gen_allowlisttest_binding.go // Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. //go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_allowlist_binding.go gen_allowlisttest_binding.go && rm -f gen_allowlist_binding.go.bak gen_allowlisttest_binding.go.bak" diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/compile.go b/precompile/contracts/feemanager/feemanagertest/bindings/compile.go index be6da6da86..28d9e6d29c 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/compile.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/compile.go @@ -9,4 +9,5 @@ package bindings //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IFeeManager --abi artifacts/IFeeManager.abi --bin artifacts/IFeeManager.bin --out gen_ifeemanager_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type FeeManagerTest --abi artifacts/FeeManagerTest.abi --bin artifacts/FeeManagerTest.bin --out gen_feemanagertest_binding.go // Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. //go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_ifeemanager_binding.go gen_feemanagertest_binding.go && rm -f gen_ifeemanager_binding.go.bak gen_feemanagertest_binding.go.bak" diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/compile.go b/precompile/contracts/nativeminter/nativemintertest/bindings/compile.go index d62e697717..e04c069262 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/compile.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/compile.go @@ -9,4 +9,5 @@ package bindings //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type INativeMinter --abi artifacts/INativeMinter.abi --bin artifacts/INativeMinter.bin --out gen_inativeminter_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type NativeMinterTest --abi artifacts/NativeMinterTest.abi --bin artifacts/NativeMinterTest.bin --out gen_nativemintertest_binding.go // Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. //go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_inativeminter_binding.go gen_nativemintertest_binding.go && rm -f gen_inativeminter_binding.go.bak gen_nativemintertest_binding.go.bak" diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go index c0c4821bbc..9542888f9d 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go @@ -9,4 +9,5 @@ package bindings //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IRewardManager --abi artifacts/IRewardManager.abi --bin artifacts/IRewardManager.bin --out gen_irewardmanager_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type RewardManagerTest --abi artifacts/RewardManagerTest.abi --bin artifacts/RewardManagerTest.bin --out gen_rewardmanagertest_binding.go // Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. //go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_irewardmanager_binding.go gen_rewardmanagertest_binding.go && rm -f gen_irewardmanager_binding.go.bak gen_rewardmanagertest_binding.go.bak" From 72d5ebe5822c0046f23c9a338600181e047b73b9 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 11:21:12 -0500 Subject: [PATCH 24/73] chore: regenerate bindings --- .../allowlisttest/bindings/gen_allowlisttest_binding.go | 2 +- .../feemanagertest/bindings/gen_feemanagertest_binding.go | 2 +- .../nativemintertest/bindings/gen_nativemintertest_binding.go | 2 +- .../rewardmanagertest/bindings/gen_rewardmanagertest_binding.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go index c723bb1d4c..454de07a82 100644 --- a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go +++ b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go @@ -32,7 +32,7 @@ var ( // AllowListTestMetaData contains all meta data concerning the AllowListTest contract. var AllowListTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220101ecbafa703de68466fcefd77409333adbc67ccb8c23001c8d3577ceeaea00c64736f6c634300081e0033a2646970667358221220200b29b9e9e528cae0d288329d2bf9a74c22ab9126627951908043f2145940ed64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea26469706673582212209fa7e0b73735215c4518ab90cd0057844da9b0faf17116d42f59c0864ce1e3e164736f6c634300081e0033a2646970667358221220bc77acfccee278d6c8dedba3b6597b0463e351597d416dc3047d3b26ef63379064736f6c634300081e0033", } // AllowListTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go index 8027b39e63..ccaaa8c86d 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go @@ -32,7 +32,7 @@ var ( // FeeManagerTestMetaData contains all meta data concerning the FeeManagerTest contract. var FeeManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getFeeConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeeConfigLastChangedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"name\":\"setFeeConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220d8299474e787e7eec716788852f61e293bf40722aa9a1bc325a5e43fd1abccae64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220d6ddea0a4ae7f1c1e47b4182684adfac205d67a0bbaba52c4497b64aa18c784e64736f6c634300081e0033", } // FeeManagerTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index 3424da268d..3fe494f662 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220c643962218d1e38fb216eed32be0b372f921a26103886839dc3efb697c60c11264736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220365a33bfddbabb1bbedf5f162b99f37cf602aa6e4a3671449c690b188c07ff3364736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go index 571efa965a..a1527f4aae 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -32,7 +32,7 @@ var ( // RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. var RewardManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220d7d7371612dbee7d8c25ef71706385ba65b29518f601aa8fce591bc668a0f79764736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea26469706673582212206d8139a189ac86c4c295b33cd613addbac4c3725cda83db1c9be8c122dc4620964736f6c634300081e0033", } // RewardManagerTestABI is the input ABI used to generate the binding from. From 0804768e4a5027560d62a3378c9a4d70b5fdb1cb Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 11:37:23 -0500 Subject: [PATCH 25/73] test: convert warp hardhat test to go --- tests/warp/warp_test.go | 59 ++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index e715a30907..dbbc4ea61f 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -7,12 +7,9 @@ package warp import ( "context" "crypto/ecdsa" - "encoding/hex" "fmt" "math/big" - "os" "path/filepath" - "strconv" "strings" "testing" "time" @@ -171,8 +168,8 @@ var _ = ginkgo.Describe("[Warp]", func() { log.Info("Delivering block hash payload to receiving subnet") w.deliverBlockHashPayload() - log.Info("Executing HardHat test") - w.executeHardHatTest() + log.Info("Verifying warp message and blockchain ID") + w.verifyWarpMessageAndBlockchainID() log.Info("Executing warp load test") w.warpLoad() @@ -549,33 +546,49 @@ func (w *warpTest) deliverBlockHashPayload() { require.Equal(types.ReceiptStatusSuccessful, receipt.Status) } -func (w *warpTest) executeHardHatTest() { +func (w *warpTest) verifyWarpMessageAndBlockchainID() { require := require.New(ginkgo.GinkgoT()) tc := e2e.NewTestContext() ctx := tc.DefaultContext() client := w.sendingSubnetClients[0] - log.Info("Subscribing to new heads") - newHeads := make(chan *types.Header, 10) - sub, err := client.SubscribeNewHead(ctx, newHeads) + + log.Info("Verifying warp message fields", + "messageID", w.addressedCallUnsignedMessage.ID(), + "sourceChainID", w.addressedCallUnsignedMessage.SourceChainID, + ) + + require.Equal( + w.sendingSubnet.BlockchainID, + w.addressedCallUnsignedMessage.SourceChainID, + "source chain ID mismatch in unsigned message", + ) + + log.Info("Calling getBlockchainID on warp precompile") + packedInput, err := warp.PackGetBlockchainID() require.NoError(err) - defer sub.Unsubscribe() - chainID, err := client.ChainID(ctx) + result, err := client.CallContract(ctx, ethereum.CallMsg{ + To: &warp.Module.Address, + Data: packedInput, + }, nil) require.NoError(err) - rpcURI := toRPCURI(w.sendingSubnetURIs[0], w.sendingSubnet.BlockchainID.String()) + require.Len(result, 32, "getBlockchainID should return 32 bytes") + returnedBlockchainID := ids.ID(common.BytesToHash(result)) - os.Setenv("SENDER_ADDRESS", crypto.PubkeyToAddress(w.sendingSubnetFundedKey.PublicKey).Hex()) - os.Setenv("SOURCE_CHAIN_ID", "0x"+w.sendingSubnet.BlockchainID.Hex()) - os.Setenv("PAYLOAD", "0x"+common.Bytes2Hex(testPayload)) - os.Setenv("EXPECTED_UNSIGNED_MESSAGE", "0x"+hex.EncodeToString(w.addressedCallUnsignedMessage.Bytes())) - os.Setenv("CHAIN_ID", strconv.FormatUint(chainID.Uint64(), 10)) + log.Info("getBlockchainID returned", "blockchainID", returnedBlockchainID) + require.Equal( + w.sendingSubnet.BlockchainID, + returnedBlockchainID, + "getBlockchainID returned unexpected value", + ) - cmdPath := filepath.Join(repoRootPath, "contracts") - // test path is relative to the cmd path - testPath := "./test/warp.ts" - utils.RunHardhatTestsCustomURI(ctx, rpcURI, cmdPath, testPath) + log.Info("Warp message and blockchain ID verification complete", + "senderAddress", crypto.PubkeyToAddress(w.sendingSubnetFundedKey.PublicKey).Hex(), + "sourceChainID", "0x"+w.sendingSubnet.BlockchainID.Hex(), + "payload", "0x"+common.Bytes2Hex(testPayload), + ) } func (w *warpTest) warpLoad() { @@ -722,7 +735,3 @@ func generateKeys(preFundedKey *ecdsa.PrivateKey, numWorkers int) ([]*key.Key, [ func toWebsocketURI(uri string, blockchainID string) string { return fmt.Sprintf("ws://%s/ext/bc/%s/ws", strings.TrimPrefix(uri, "http://"), blockchainID) } - -func toRPCURI(uri string, blockchainID string) string { - return fmt.Sprintf("%s/ext/bc/%s/rpc", uri, blockchainID) -} From 6877bd89b5b8a98b3ee215bd866b3fc989af0008 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Fri, 5 Dec 2025 20:22:26 +0300 Subject: [PATCH 26/73] reduce diff with master --- .github/workflows/ci.yml | 29 ++++++ Taskfile.yml | 11 +++ contracts/index.ts | 1 + contracts/test/utils.ts | 132 ++++++++++++++++++++++++++++ scripts/run_ginkgo_precompile.sh | 22 +++++ tests/precompile/precompile_test.go | 22 +++++ tests/precompile/solidity/suites.go | 74 ++++++++++++++++ 7 files changed, 291 insertions(+) create mode 100644 contracts/index.ts create mode 100644 contracts/test/utils.ts create mode 100755 scripts/run_ginkgo_precompile.sh create mode 100644 tests/precompile/precompile_test.go create mode 100644 tests/precompile/solidity/suites.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bebf39174d..5737d55c9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,35 @@ jobs: TIMEOUT: ${{ env.TIMEOUT }} - run: ./scripts/run_task.sh coverage + e2e_precompile: + name: e2e precompile tests + runs-on: ubuntu-latest + steps: + - name: Git checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - name: Set up solc + uses: ARR4N/setup-solc@v0.2.0 + with: + versions: "0.8.30" + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.13" + - name: Setup Contracts + run: ./scripts/run_task.sh setup-contracts + - name: Run E2E Precompile Tests + run: ./scripts/run_task.sh test-e2e-precompile-ci + - name: Upload Artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: subnet-evm-e2e-logs-precompile + path: /tmp/e2e-test/precompile-data + retention-days: 5 + e2e_warp: name: e2e warp tests runs-on: ubuntu-latest diff --git a/Taskfile.yml b/Taskfile.yml index ea9d652748..de8ca8c54c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -187,6 +187,17 @@ tasks: - task: build - task: test-e2e-load + test-e2e-precompile: + desc: Run end-to-end precompile tests using Ginkgo with parallel execution + cmd: bash -x ./scripts/run_ginkgo_precompile.sh # ci.yml + + test-e2e-precompile-ci: # consolidated test-e2e-precompile + desc: Run E2E precompile tests with CI setup + cmds: + - task: install-avalanchego-release + - task: build + - task: test-e2e-precompile + test-e2e-warp: desc: Run end-to-end warp tests using Ginkgo test framework cmd: bash -x ./scripts/run_ginkgo_warp.sh # ci.yml diff --git a/contracts/index.ts b/contracts/index.ts new file mode 100644 index 0000000000..fb69b71c8a --- /dev/null +++ b/contracts/index.ts @@ -0,0 +1 @@ +export { test } from './test/utils'; diff --git a/contracts/test/utils.ts b/contracts/test/utils.ts new file mode 100644 index 0000000000..aa85b66733 --- /dev/null +++ b/contracts/test/utils.ts @@ -0,0 +1,132 @@ +import { ethers } from "hardhat" +import { Overrides } from "ethers" +import assert from "assert" + +/* + * + * The `test` function is a wrapper around Mocha's `it` function. It provides a normalized framework for running the + * majority of your test assertions inside of a smart-contract, using `DS-Test`. + * The API can be used as follows (all of the examples are equivalent): + * ```ts + * test("", "") + * test("", [""]) + * test("", { method: "", overrides: {}, shouldFail: false, debug: false }) + * test("", [{ method: "", overrides: {}, shouldFail: false, debug: false }]) + * test("", [{ method: "", shouldFail: false, debug: false }], {}) + * ``` + * Many contract functions can be called as a part of the same test: + * ```ts + * test("", ["", "", ""]) + * ``` + * Individual test functions can describe their own overrides with the `overrides` property. + * If an object is passed in as the third argument to `test`, it will be used as the default overrides for all test + * functions. + * The following are equivalent: + * ```ts + * test("", [{ method: "", overrides: { from: "0x123" } }]) + * test("", [{ method: "" }], { from: "0x123" }) + * ``` + * In the above cases, the `from` override must be a signer. + * The `shouldFail` property can be used to indicate that the test function should fail. This should be used sparingly + * as it is not possible to match on the failure reason. + * Furthermore, the `debug` property can be used to print any thrown errors when attempting to + * send a transaction or while waiting for the transaction to be confirmed (the transaction is the smart contract call). + * `debug` will also cause any parseable event logs to be printed that start with the `log_` prefix. + * `DSTest` contracts have several options for emitting `log_` events. + * + */ + +// Below are the types that help define all the different ways to call `test` +type FnNameOrObject = string | string[] | MethodObject | MethodObject[] + +// Limit `from` property to be a `string` instead of `string | Promise` +type CallOverrides = Overrides & { from?: string } + +type MethodObject = { method: string, debug?: boolean, overrides?: CallOverrides, shouldFail?: boolean } + +// This type is after all default values have been applied +type MethodWithDebugAndOverrides = MethodObject & { debug: boolean, overrides: CallOverrides, shouldFail: boolean } + +// `test` is used very similarly to `it` from Mocha +export const test = (name, fnNameOrObject, overrides = {}) => it(name, buildTestFn(fnNameOrObject, overrides)) +// `test.only` is used very similarly to `it.only` from Mocha, it will isolate all tests marked with `test.only` +test.only = (name, fnNameOrObject, overrides = {}) => it.only(name, buildTestFn(fnNameOrObject, overrides)) +// `test.debug` is used to apply `debug: true` to all DSTest contract method calls in the test +test.debug = (name, fnNameOrObject, overrides = {}) => it.only(name, buildTestFn(fnNameOrObject, overrides, true)) +// `test.skip` is used very similarly to `it.skip` from Mocha, it will skip all tests marked with `test.skip` +test.skip = (name, fnNameOrObject, overrides = {}) => it.skip(name, buildTestFn(fnNameOrObject, overrides)) + +// `buildTestFn` is a higher-order function. It returns a function that can be used as the test function for `it` +const buildTestFn = (fnNameOrObject: FnNameOrObject, overrides = {}, debug = false) => { + // normalize the input to an array of objects + const fnObjects: MethodWithDebugAndOverrides[] = (Array.isArray(fnNameOrObject) ? fnNameOrObject : [fnNameOrObject]).map(fnNameOrObject => { + fnNameOrObject = typeof fnNameOrObject === 'string' ? { method: fnNameOrObject } : fnNameOrObject + // assign all default values and overrides + fnNameOrObject.overrides = Object.assign({}, overrides, fnNameOrObject.overrides ?? {}) + fnNameOrObject.debug = fnNameOrObject.debug ?? debug + fnNameOrObject.shouldFail = fnNameOrObject.shouldFail ?? false + + return fnNameOrObject as MethodWithDebugAndOverrides + }) + + // only `step_` prefixed functions can be called on the `DSTest` contracts to clearly separate tests and helpers + assert(fnObjects.every(({ method }) => method.startsWith('step_')), "Solidity test functions must be prefixed with 'step_'") + + // return the test function that will be used by `it` + // this function must be defined with the `function` keyword so that `this` is bound to the Mocha context + return async function () { + // `Array.prototype.reduce` is used here to ensure that the test functions are called in order. + // Each test function waits for its predecessor to complete before starting + return fnObjects.reduce((p: Promise, fn) => p.then(async () => { + const contract = fn.overrides.from + ? this.testContract.connect(await ethers.getSigner(fn.overrides.from)) + : this.testContract + const tx = await contract[fn.method](fn.overrides).catch(err => { + if (fn.shouldFail) { + if (fn.debug){ + console.error(`smart contract call failed with error:\n${err}\n`) + } + + return { failed: true } + } + + console.error("smart contract call failed with error:", err) + throw err + }) + + // no more assertions necessary if the method-call should fail and did fail + if (tx.failed && fn.shouldFail) return + + const txReceipt = await tx.wait().catch(err => { + if (fn.debug) console.error(`tx failed with error:\n${err}\n`) + return err.receipt + }) + + // `txReceipt.status` will be `0` if the transaction failed. + // `contract.failed` will return `true` if any of the `DSTest` assertions failed. + const failed = txReceipt.status === 0 ? true : await contract.failed.staticCall() + if (fn.debug || failed) { + console.log('') + + if (!txReceipt.events) console.warn('WARNING: No parseable events found in tx-receipt\n') + + // If `DSTest` assertions failed, the contract will emit logs describing the assertion failure(s). + txReceipt + .events + ?.filter(event => fn.debug || event.event?.startsWith('log')) + .map(event => event.args?.forEach(arg => console.log(arg))) + + console.log('') + } + + assert(!failed, `${fn.method} failed`) + }), Promise.resolve()) + } +} + +export const Roles = { + None: 0, + Enabled: 1, + Admin: 2, + Manager: 3, +} diff --git a/scripts/run_ginkgo_precompile.sh b/scripts/run_ginkgo_precompile.sh new file mode 100755 index 0000000000..01315ffbe6 --- /dev/null +++ b/scripts/run_ginkgo_precompile.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -e + +# This script assumes that an AvalancheGo and Subnet-EVM binaries are available in the standard location +# within the $GOPATH +# The AvalancheGo and PluginDir paths can be specified via the environment variables used in ./scripts/run.sh. + +SUBNET_EVM_PATH=$( + cd "$(dirname "${BASH_SOURCE[0]}")" + cd .. && pwd +) + +source "$SUBNET_EVM_PATH"/scripts/constants.sh + +TEST_SOURCE_ROOT=$(pwd) + +# By default, it runs all e2e test cases! +# Use "--ginkgo.skip" to skip tests. +# Use "--ginkgo.focus" to select tests. +TEST_SOURCE_ROOT="$TEST_SOURCE_ROOT" "${SUBNET_EVM_PATH}"/bin/ginkgo run -procs=5 tests/precompile \ + --ginkgo.vv \ + --ginkgo.label-filter="${GINKGO_LABEL_FILTER:-""}" diff --git a/tests/precompile/precompile_test.go b/tests/precompile/precompile_test.go new file mode 100644 index 0000000000..a4bd1dd5e9 --- /dev/null +++ b/tests/precompile/precompile_test.go @@ -0,0 +1,22 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package precompile + +import ( + "os" + "testing" + + // Import the solidity package, so that ginkgo maps out the tests declared within the package + "github.com/ava-labs/subnet-evm/tests/precompile/solidity" + + ginkgo "github.com/onsi/ginkgo/v2" +) + +func TestE2E(t *testing.T) { + if basePath := os.Getenv("TEST_SOURCE_ROOT"); basePath != "" { + t.Chdir(basePath) + } + solidity.RegisterAsyncTests() + ginkgo.RunSpecs(t, "subnet-evm precompile ginkgo test suite") +} diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go new file mode 100644 index 0000000000..0566ab33d6 --- /dev/null +++ b/tests/precompile/solidity/suites.go @@ -0,0 +1,74 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +// Implements solidity tests. +package solidity + +import ( + "context" + "fmt" + "time" + + "github.com/ava-labs/subnet-evm/tests/utils" + + ginkgo "github.com/onsi/ginkgo/v2" +) + +// Registers the Asynchronized Precompile Tests +// Before running the tests, this function creates all subnets given in the genesis files +// and then runs the hardhat tests for each one asynchronously if called with `ginkgo run -procs=`. +func RegisterAsyncTests() { + // Tests here assumes that the genesis files are in ./tests/precompile/genesis/ + // with the name {precompile_name}.json + genesisFiles, err := utils.GetFilesAndAliases("./tests/precompile/genesis/*.json") + if err != nil { + ginkgo.AbortSuite("Failed to get genesis files: " + err.Error()) + } + if len(genesisFiles) == 0 { + ginkgo.AbortSuite("No genesis files found") + } + subnetsSuite := utils.CreateSubnetsSuite(genesisFiles) + + timeout := 3 * time.Minute + _ = ginkgo.Describe("[Asynchronized Precompile Tests]", func() { + // Register the ping test first + utils.RegisterPingTest() + + // Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/) + // to use to launch the subnet and the name of the TS test file to run on the subnet (in ./contracts/tests/) + + ginkgo.It("reward manager", ginkgo.Label("Precompile"), ginkgo.Label("RewardManager"), func() { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + blockchainID := subnetsSuite.GetBlockchainID("reward_manager") + runDefaultHardhatTests(ctx, blockchainID, "reward_manager") + }) + + // ADD YOUR PRECOMPILE HERE + /* + ginkgo.It("your precompile", ginkgo.Label("Precompile"), ginkgo.Label("YourPrecompile"), func() { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() + + // Specify the name shared by the genesis file in ./tests/precompile/genesis/{your_precompile}.json + // and the test file in ./contracts/tests/{your_precompile}.ts + // If you want to use a different test command and genesis path than the defaults, you can + // use the utils.RunTestCMD. See utils.RunDefaultHardhatTests for an example. + subnetsSuite.RunHardhatTests(ctx, "your_precompile") + }) + */ + }) +} + +// Default parameters are: +// +// 1. Hardhat contract environment is located at ./contracts +// 2. Hardhat test file is located at ./contracts/test/.ts +// 3. npx is available in the ./contracts directory +func runDefaultHardhatTests(ctx context.Context, blockchainID, testName string) { + cmdPath := "./contracts" + // test path is relative to the cmd path + testPath := fmt.Sprintf("./test/%s.ts", testName) + utils.RunHardhatTests(ctx, blockchainID, cmdPath, testPath) +} From 650bd1d9091b910c2e5a66a4e90725b24ef3f4ac Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Fri, 5 Dec 2025 20:32:21 +0300 Subject: [PATCH 27/73] further reduce diffs --- .../allowlisttest/bindings/IAllowList.sol | 27 +++--- .../bindings/gen_allowlisttest_binding.go | 2 +- .../allowlisttest/test_allowlist_events.go | 2 + .../bindings/FeeManagerTest.sol | 94 +++++++++---------- .../feemanagertest/bindings/IFeeManager.sol | 83 ++++++++-------- .../bindings/gen_feemanagertest_binding.go | 2 +- .../bindings/INativeMinter.sol | 10 +- .../bindings/NativeMinterTest.sol | 21 +++-- .../bindings/gen_nativemintertest_binding.go | 2 +- 9 files changed, 115 insertions(+), 128 deletions(-) diff --git a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol index 2e031d0bf1..8b525b12e1 100644 --- a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol +++ b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol @@ -2,25 +2,20 @@ pragma solidity ^0.8.24; interface IAllowList { - event RoleSet( - uint256 indexed role, - address indexed account, - address indexed sender, - uint256 oldRole - ); + event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole); - // Set [addr] to have the admin role over the precompile contract. - function setAdmin(address addr) external; + // Set [addr] to have the admin role over the precompile contract. + function setAdmin(address addr) external; - // Set [addr] to be enabled on the precompile contract. - function setEnabled(address addr) external; + // Set [addr] to be enabled on the precompile contract. + function setEnabled(address addr) external; - // Set [addr] to have the manager role over the precompile contract. - function setManager(address addr) external; + // Set [addr] to have the manager role over the precompile contract. + function setManager(address addr) external; - // Set [addr] to have no role for the precompile contract. - function setNone(address addr) external; + // Set [addr] to have no role for the precompile contract. + function setNone(address addr) external; - // Read the status of [addr]. - function readAllowList(address addr) external view returns (uint256 role); + // Read the status of [addr]. + function readAllowList(address addr) external view returns (uint256 role); } diff --git a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go index 454de07a82..4ce13be5dd 100644 --- a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go +++ b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go @@ -32,7 +32,7 @@ var ( // AllowListTestMetaData contains all meta data concerning the AllowListTest contract. var AllowListTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea26469706673582212209fa7e0b73735215c4518ab90cd0057844da9b0faf17116d42f59c0864ce1e3e164736f6c634300081e0033a2646970667358221220bc77acfccee278d6c8dedba3b6597b0463e351597d416dc3047d3b26ef63379064736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220a6f35569427acc58ad5367cdacdafc7cbf00ed36744b876fba3bd8433689c4a564736f6c634300081e0033a2646970667358221220b9610a9e66cd5a3a7c0ccc575d7228dff9f3846ffc78cf4eccd34dd152f9297664736f6c634300081e0033", } // AllowListTestABI is the input ABI used to generate the binding from. diff --git a/precompile/allowlist/allowlisttest/test_allowlist_events.go b/precompile/allowlist/allowlisttest/test_allowlist_events.go index ea68cda8ad..178821bc4b 100644 --- a/precompile/allowlist/allowlisttest/test_allowlist_events.go +++ b/precompile/allowlist/allowlisttest/test_allowlist_events.go @@ -133,6 +133,7 @@ func RunAllowListEventTests( require.NoError(err) defer iter.Close() + // Verify event fields match expected values for _, expectedEvent := range tc.expectedEvents { require.True(iter.Next(), "expected to find RoleSet event") event := iter.Event @@ -142,6 +143,7 @@ func RunAllowListEventTests( require.Zero(expectedEvent.OldRole.Cmp(event.OldRole), "oldRole mismatch") } + // Verify there are no more events require.False(iter.Next(), "expected no more RoleSet events") require.NoError(iter.Error()) }) diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol b/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol index 913d955001..f252b0f9fc 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol +++ b/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol @@ -4,55 +4,55 @@ pragma solidity ^0.8.24; import "./IFeeManager.sol"; contract FeeManagerTest { - IFeeManager private feeManager; + IFeeManager private feeManager; - constructor(address feeManagerPrecompile) { - feeManager = IFeeManager(feeManagerPrecompile); - } + constructor(address feeManagerPrecompile) { + feeManager = IFeeManager(feeManagerPrecompile); + } - // Calls the setFeeConfig function on the precompile - function setFeeConfig( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) external { - feeManager.setFeeConfig( - gasLimit, - targetBlockRate, - minBaseFee, - targetGas, - baseFeeChangeDenominator, - minBlockGasCost, - maxBlockGasCost, - blockGasCostStep - ); - } + // Calls the setFeeConfig function on the precompile + function setFeeConfig( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) external { + feeManager.setFeeConfig( + gasLimit, + targetBlockRate, + minBaseFee, + targetGas, + baseFeeChangeDenominator, + minBlockGasCost, + maxBlockGasCost, + blockGasCostStep + ); + } - // Calls the getFeeConfig function on the precompile - function getFeeConfig() - external - view - returns ( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) - { - return feeManager.getFeeConfig(); - } + // Calls the getFeeConfig function on the precompile + function getFeeConfig() + external + view + returns ( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) + { + return feeManager.getFeeConfig(); + } - // Calls the getFeeConfigLastChangedAt function on the precompile - function getFeeConfigLastChangedAt() external view returns (uint256) { - return feeManager.getFeeConfigLastChangedAt(); - } + // Calls the getFeeConfigLastChangedAt function on the precompile + function getFeeConfigLastChangedAt() external view returns (uint256) { + return feeManager.getFeeConfigLastChangedAt(); + } } diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol b/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol index 21b475edf0..a49234e326 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol +++ b/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol @@ -3,52 +3,45 @@ pragma solidity ^0.8.24; import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; interface IFeeManager is IAllowList { - struct FeeConfig { - uint256 gasLimit; - uint256 targetBlockRate; - uint256 minBaseFee; - uint256 targetGas; - uint256 baseFeeChangeDenominator; - uint256 minBlockGasCost; - uint256 maxBlockGasCost; - uint256 blockGasCostStep; - } - event FeeConfigChanged( - address indexed sender, - FeeConfig oldFeeConfig, - FeeConfig newFeeConfig - ); + struct FeeConfig { + uint256 gasLimit; + uint256 targetBlockRate; + uint256 minBaseFee; + uint256 targetGas; + uint256 baseFeeChangeDenominator; + uint256 minBlockGasCost; + uint256 maxBlockGasCost; + uint256 blockGasCostStep; + } + event FeeConfigChanged(address indexed sender, FeeConfig oldFeeConfig, FeeConfig newFeeConfig); - // Set fee config fields to contract storage - function setFeeConfig( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) external; + // Set fee config fields to contract storage + function setFeeConfig( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) external; - // Get fee config from the contract storage - function getFeeConfig() - external - view - returns ( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ); + // Get fee config from the contract storage + function getFeeConfig() + external + view + returns ( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ); - // Get the last block number changed the fee config from the contract storage - function getFeeConfigLastChangedAt() - external - view - returns (uint256 blockNumber); + // Get the last block number changed the fee config from the contract storage + function getFeeConfigLastChangedAt() external view returns (uint256 blockNumber); } diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go index ccaaa8c86d..bf39c61e76 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go @@ -32,7 +32,7 @@ var ( // FeeManagerTestMetaData contains all meta data concerning the FeeManagerTest contract. var FeeManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getFeeConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeeConfigLastChangedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"name\":\"setFeeConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220d6ddea0a4ae7f1c1e47b4182684adfac205d67a0bbaba52c4497b64aa18c784e64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea26469706673582212202589a5e482d11e8833ad4feb162fb81f20fc80dedb5b2e63ec163cabd71ae43264736f6c634300081e0033", } // FeeManagerTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol b/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol index fcb917b672..7fd63a55c9 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol @@ -3,11 +3,7 @@ pragma solidity ^0.8.24; import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; interface INativeMinter is IAllowList { - event NativeCoinMinted( - address indexed sender, - address indexed recipient, - uint256 amount - ); - // Mint [amount] number of native coins and send to [addr] - function mintNativeCoin(address addr, uint256 amount) external; + event NativeCoinMinted(address indexed sender, address indexed recipient, uint256 amount); + // Mint [amount] number of native coins and send to [addr] + function mintNativeCoin(address addr, uint256 amount) external; } diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol b/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol index f108f043ae..7220cf35b4 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol @@ -4,17 +4,18 @@ pragma solidity ^0.8.24; import "./INativeMinter.sol"; contract NativeMinterTest { - INativeMinter private nativeMinter; + INativeMinter private nativeMinter; - constructor(address nativeMinterPrecompile) { - nativeMinter = INativeMinter(nativeMinterPrecompile); - } + constructor(address nativeMinterPrecompile) { + nativeMinter = INativeMinter(nativeMinterPrecompile); + } - // Calls the mintNativeCoin function on the precompile - function mintNativeCoin(address addr, uint256 amount) external { - nativeMinter.mintNativeCoin(addr, amount); - } + // Calls the mintNativeCoin function on the precompile + function mintNativeCoin(address addr, uint256 amount) external { + nativeMinter.mintNativeCoin(addr, amount); + } - // Allows this contract to receive native coins - receive() external payable {} + // Allows this contract to receive native coins + receive() external payable {} } + diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index 3fe494f662..696d206166 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220365a33bfddbabb1bbedf5f162b99f37cf602aa6e4a3671449c690b188c07ff3364736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea264697066735822122022a495ab74b25db78e2d373ef8499eee646e53fb4eb515ac693575252359c1ae64736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. From ddc92e71bdafa36ca08bb66e934d292a90041b84 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Fri, 5 Dec 2025 20:34:34 +0300 Subject: [PATCH 28/73] further reduce diffs --- tests/precompile/solidity/suites.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index 0566ab33d6..de273f23db 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -7,7 +7,6 @@ package solidity import ( "context" "fmt" - "time" "github.com/ava-labs/subnet-evm/tests/utils" @@ -27,9 +26,6 @@ func RegisterAsyncTests() { if len(genesisFiles) == 0 { ginkgo.AbortSuite("No genesis files found") } - subnetsSuite := utils.CreateSubnetsSuite(genesisFiles) - - timeout := 3 * time.Minute _ = ginkgo.Describe("[Asynchronized Precompile Tests]", func() { // Register the ping test first utils.RegisterPingTest() @@ -37,14 +33,6 @@ func RegisterAsyncTests() { // Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/) // to use to launch the subnet and the name of the TS test file to run on the subnet (in ./contracts/tests/) - ginkgo.It("reward manager", ginkgo.Label("Precompile"), ginkgo.Label("RewardManager"), func() { - ctx, cancel := context.WithTimeout(context.Background(), timeout) - defer cancel() - - blockchainID := subnetsSuite.GetBlockchainID("reward_manager") - runDefaultHardhatTests(ctx, blockchainID, "reward_manager") - }) - // ADD YOUR PRECOMPILE HERE /* ginkgo.It("your precompile", ginkgo.Label("Precompile"), ginkgo.Label("YourPrecompile"), func() { From a024dc6c3d7e8a228b6cae398b4155747aca27a6 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Fri, 5 Dec 2025 20:38:36 +0300 Subject: [PATCH 29/73] fix linter --- tests/precompile/solidity/suites.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index de273f23db..9e8d8d7f0a 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -5,9 +5,6 @@ package solidity import ( - "context" - "fmt" - "github.com/ava-labs/subnet-evm/tests/utils" ginkgo "github.com/onsi/ginkgo/v2" @@ -48,15 +45,3 @@ func RegisterAsyncTests() { */ }) } - -// Default parameters are: -// -// 1. Hardhat contract environment is located at ./contracts -// 2. Hardhat test file is located at ./contracts/test/.ts -// 3. npx is available in the ./contracts directory -func runDefaultHardhatTests(ctx context.Context, blockchainID, testName string) { - cmdPath := "./contracts" - // test path is relative to the cmd path - testPath := fmt.Sprintf("./test/%s.ts", testName) - utils.RunHardhatTests(ctx, blockchainID, cmdPath, testPath) -} From 9afb94c089055ba1333f4266e05a6b5e1b599a2a Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Fri, 5 Dec 2025 20:43:58 +0300 Subject: [PATCH 30/73] fix --- .../bindings/gen_rewardmanagertest_binding.go | 2 +- tests/precompile/solidity/suites.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go index a1527f4aae..8a0c62d2ef 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -32,7 +32,7 @@ var ( // RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. var RewardManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea26469706673582212206d8139a189ac86c4c295b33cd613addbac4c3725cda83db1c9be8c122dc4620964736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220ccd3262a78a2a69cdedd481e181692ee33d9480f66c85047c9603b3398a906d064736f6c634300081e0033", } // RewardManagerTestABI is the input ABI used to generate the binding from. diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index 9e8d8d7f0a..fe9409e9db 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -21,12 +21,9 @@ func RegisterAsyncTests() { ginkgo.AbortSuite("Failed to get genesis files: " + err.Error()) } if len(genesisFiles) == 0 { - ginkgo.AbortSuite("No genesis files found") + ginkgo.Skip("No genesis files found") } _ = ginkgo.Describe("[Asynchronized Precompile Tests]", func() { - // Register the ping test first - utils.RegisterPingTest() - // Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/) // to use to launch the subnet and the name of the TS test file to run on the subnet (in ./contracts/tests/) From 8d6af337d9b977e572fbff284cb0131a536a64c6 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:04:38 -0500 Subject: [PATCH 31/73] style: move tx function --- .../contracts/rewardmanager/simulated_test.go | 45 ++++++++++++++++++- .../contracts/testutils/simulated_helpers.go | 39 ---------------- 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 9d6ffc3dc7..819ef6bff0 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -4,9 +4,12 @@ package rewardmanager_test import ( + "crypto/ecdsa" + "math/big" "testing" "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" "github.com/ava-labs/libevm/core/vm" "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" @@ -50,6 +53,44 @@ func deployRewardManagerTest(t *testing.T, b *sim.Backend, auth *bind.TransactOp return addr, contract } +// SendSimpleTx sends a simple ETH transfer transaction +// See ethclient/simulated/backend_test.go newTx() for the source of this code +// TODO(jonathanoppenheimer): after libevmifiying the geth code, investigate whether we can use the same code for both +func SendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Transaction { + t.Helper() + client := b.Client() + addr := crypto.PubkeyToAddress(key.PublicKey) + + chainID, err := client.ChainID(t.Context()) + require.NoError(t, err) + + nonce, err := client.NonceAt(t.Context(), addr, nil) + require.NoError(t, err) + + head, err := client.HeaderByNumber(t.Context(), nil) + require.NoError(t, err) + + gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei)) + + tx := types.NewTx(&types.DynamicFeeTx{ + ChainID: chainID, + Nonce: nonce, + GasTipCap: big.NewInt(params.GWei), + GasFeeCap: gasPrice, + Gas: 21000, + To: &addr, + Value: big.NewInt(0), + }) + + signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(chainID), key) + require.NoError(t, err) + + err = client.SendTransaction(t.Context(), signedTx) + require.NoError(t, err) + + return signedTx +} + func TestRewardManager(t *testing.T) { chainID := params.TestChainConfig.ChainID admin := testutils.NewAuth(t, adminKey, chainID) @@ -175,7 +216,7 @@ func TestRewardManager(t *testing.T) { initialBlackholeBalance, err := client.BalanceAt(t.Context(), constants.BlackholeAddr, nil) require.NoError(t, err) - tx := testutils.SendSimpleTx(t, backend, adminKey) + tx := SendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) newBlackholeBalance, err := client.BalanceAt(t.Context(), constants.BlackholeAddr, nil) @@ -206,7 +247,7 @@ func TestRewardManager(t *testing.T) { require.Equal(t, rewardRecipientAddr, currentAddr) // The fees from this transaction should go to the reward address - tx = testutils.SendSimpleTx(t, backend, adminKey) + tx = SendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) newRecipientBalance, err := client.BalanceAt(t.Context(), rewardRecipientAddr, nil) diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 2d829bd1c9..8cce014eed 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -10,7 +10,6 @@ import ( "github.com/ava-labs/libevm/common" "github.com/ava-labs/libevm/core/types" - "github.com/ava-labs/libevm/crypto" "github.com/stretchr/testify/require" "github.com/ava-labs/subnet-evm/accounts/abi/bind" @@ -62,41 +61,3 @@ func WaitReceiptSuccessful(t *testing.T, b *sim.Backend, tx *types.Transaction) require.Equal(t, types.ReceiptStatusSuccessful, receipt.Status, "transaction should succeed") return receipt } - -// SendSimpleTx sends a simple ETH transfer transaction -// See ethclient/simulated/backend_test.go newTx() for the source of this code -// TODO(jonathanoppenheimer): after libevmifiying the geth code, investigate whether we can use the same code for both -func SendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Transaction { - t.Helper() - client := b.Client() - addr := crypto.PubkeyToAddress(key.PublicKey) - - chainID, err := client.ChainID(t.Context()) - require.NoError(t, err) - - nonce, err := client.NonceAt(t.Context(), addr, nil) - require.NoError(t, err) - - head, err := client.HeaderByNumber(t.Context(), nil) - require.NoError(t, err) - - gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei)) - - tx := types.NewTx(&types.DynamicFeeTx{ - ChainID: chainID, - Nonce: nonce, - GasTipCap: big.NewInt(params.GWei), - GasFeeCap: gasPrice, - Gas: 21000, - To: &addr, - Value: big.NewInt(0), - }) - - signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(chainID), key) - require.NoError(t, err) - - err = client.SendTransaction(t.Context(), signedTx) - require.NoError(t, err) - - return signedTx -} From aafb6db1a25d79942311c7eb6e22bdfac8618dd8 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:06:48 -0500 Subject: [PATCH 32/73] test: use random key for reward address test --- precompile/contracts/rewardmanager/simulated_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 819ef6bff0..696127ba04 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -231,7 +231,8 @@ func TestRewardManager(t *testing.T) { test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { client := backend.Client() - rewardRecipientAddr, _ := deployRewardManagerTest(t, backend, admin) + rewardRecipientKey, _ := crypto.GenerateKey() + rewardRecipientAddr := crypto.PubkeyToAddress(rewardRecipientKey.PublicKey) initialRecipientBalance, err := client.BalanceAt(t.Context(), rewardRecipientAddr, nil) require.NoError(t, err) From 07ab33fb71079c39324dfeba068c5b89d8f7c5a4 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:13:48 -0500 Subject: [PATCH 33/73] test: through contract rather than interface --- .../contracts/rewardmanager/simulated_test.go | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 696127ba04..381600dea5 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -231,19 +231,20 @@ func TestRewardManager(t *testing.T) { test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { client := backend.Client() + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + rewardRecipientKey, _ := crypto.GenerateKey() rewardRecipientAddr := crypto.PubkeyToAddress(rewardRecipientKey.PublicKey) initialRecipientBalance, err := client.BalanceAt(t.Context(), rewardRecipientAddr, nil) require.NoError(t, err) - allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, rewardRecipientAddr) - - tx, err := rewardManager.SetRewardAddress(admin, rewardRecipientAddr) + tx, err := testContract.SetRewardAddress(admin, rewardRecipientAddr) require.NoError(t, err) testutils.WaitReceiptSuccessful(t, backend, tx) - currentAddr, err := rewardManager.CurrentRewardAddress(nil) + currentAddr, err := testContract.CurrentRewardAddress(nil) require.NoError(t, err) require.Equal(t, rewardRecipientAddr, currentAddr) @@ -276,8 +277,6 @@ func TestRewardManager(t *testing.T) { func TestIRewardManager_Events(t *testing.T) { chainID := params.TestChainConfig.ChainID admin := testutils.NewAuth(t, adminKey, chainID) - testKey, _ := crypto.GenerateKey() - testAddress := crypto.PubkeyToAddress(testKey.PublicKey) type testCase struct { name string @@ -288,7 +287,13 @@ func TestIRewardManager_Events(t *testing.T) { { name: "should emit RewardAddressChanged event", test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { - tx, err := rewardManager.SetRewardAddress(admin, testAddress) + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + rewardRecipientKey, _ := crypto.GenerateKey() + rewardRecipientAddr := crypto.PubkeyToAddress(rewardRecipientKey.PublicKey) + + tx, err := testContract.SetRewardAddress(admin, rewardRecipientAddr) require.NoError(t, err) testutils.WaitReceiptSuccessful(t, backend, tx) @@ -298,9 +303,9 @@ func TestIRewardManager_Events(t *testing.T) { require.True(t, iter.Next(), "expected to find RewardAddressChanged event") event := iter.Event - require.Equal(t, adminAddress, event.Sender) + require.Equal(t, testContractAddr, event.Sender) require.Equal(t, constants.BlackholeAddr, event.OldRewardAddress) - require.Equal(t, testAddress, event.NewRewardAddress) + require.Equal(t, rewardRecipientAddr, event.NewRewardAddress) require.False(t, iter.Next(), "expected no more events") require.NoError(t, iter.Error()) @@ -309,7 +314,10 @@ func TestIRewardManager_Events(t *testing.T) { { name: "should emit FeeRecipientsAllowed event", test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { - tx, err := rewardManager.AllowFeeRecipients(admin) + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + tx, err := testContract.AllowFeeRecipients(admin) require.NoError(t, err) testutils.WaitReceiptSuccessful(t, backend, tx) @@ -318,7 +326,7 @@ func TestIRewardManager_Events(t *testing.T) { defer iter.Close() require.True(t, iter.Next(), "expected to find FeeRecipientsAllowed event") - require.Equal(t, adminAddress, iter.Event.Sender) + require.Equal(t, testContractAddr, iter.Event.Sender) require.False(t, iter.Next(), "expected no more events") require.NoError(t, iter.Error()) @@ -327,7 +335,10 @@ func TestIRewardManager_Events(t *testing.T) { { name: "should emit RewardsDisabled event", test: func(t *testing.T, backend *sim.Backend, rewardManager *rewardmanagerbindings.IRewardManager) { - tx, err := rewardManager.DisableRewards(admin) + testContractAddr, testContract := deployRewardManagerTest(t, backend, admin) + allowlisttest.SetAsEnabled(t, backend, rewardManager, admin, testContractAddr) + + tx, err := testContract.DisableRewards(admin) require.NoError(t, err) testutils.WaitReceiptSuccessful(t, backend, tx) @@ -336,7 +347,7 @@ func TestIRewardManager_Events(t *testing.T) { defer iter.Close() require.True(t, iter.Next(), "expected to find RewardsDisabled event") - require.Equal(t, adminAddress, iter.Event.Sender) + require.Equal(t, testContractAddr, iter.Event.Sender) require.False(t, iter.Next(), "expected no more events") require.NoError(t, iter.Error()) From 5ea2a0d6a724c4a7b570ca2da73aaf2d06664383 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Fri, 5 Dec 2025 21:14:20 +0300 Subject: [PATCH 34/73] revert extra change --- tests/precompile/solidity/suites.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/precompile/solidity/suites.go b/tests/precompile/solidity/suites.go index fe9409e9db..94c0f0d3f2 100644 --- a/tests/precompile/solidity/suites.go +++ b/tests/precompile/solidity/suites.go @@ -21,7 +21,7 @@ func RegisterAsyncTests() { ginkgo.AbortSuite("Failed to get genesis files: " + err.Error()) } if len(genesisFiles) == 0 { - ginkgo.Skip("No genesis files found") + ginkgo.AbortSuite("No genesis files found") } _ = ginkgo.Describe("[Asynchronized Precompile Tests]", func() { // Each ginkgo It node specifies the name of the genesis file (in ./tests/precompile/genesis/) From 8f146c61cddf00bea12ea57f6944a6f7cfcc839a Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:26:30 -0500 Subject: [PATCH 35/73] test: add coinbase test --- ethclient/simulated/options.go | 10 +++++ .../contracts/rewardmanager/simulated_test.go | 41 +++++++++++++++++-- .../contracts/testutils/simulated_helpers.go | 13 +++++- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/ethclient/simulated/options.go b/ethclient/simulated/options.go index 3b63e86a6e..0c2e5e9b36 100644 --- a/ethclient/simulated/options.go +++ b/ethclient/simulated/options.go @@ -30,6 +30,7 @@ package simulated import ( "math/big" + "github.com/ava-labs/libevm/common" "github.com/ava-labs/subnet-evm/eth/ethconfig" "github.com/ava-labs/subnet-evm/node" "github.com/ava-labs/subnet-evm/params" @@ -58,3 +59,12 @@ func WithChainConfig(chainConfig *params.ChainConfig) func(nodeConf *node.Config ethConf.Genesis.Config = chainConfig } } + +// WithEtherbase configures the simulated backend to use a specific etherbase/coinbase address +// for block production. This is the address that receives block rewards and transaction fees +// when allowFeeRecipients is enabled. +func WithEtherbase(etherbase common.Address) func(nodeConf *node.Config, ethConf *ethconfig.Config) { + return func(nodeConf *node.Config, ethConf *ethconfig.Config) { + ethConf.Miner.Etherbase = etherbase + } +} diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 381600dea5..4f61eab15a 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -17,6 +17,8 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/constants" "github.com/ava-labs/subnet-evm/core" + "github.com/ava-labs/subnet-evm/eth/ethconfig" + "github.com/ava-labs/subnet-evm/node" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/plugin/evm/customtypes" "github.com/ava-labs/subnet-evm/precompile/allowlist" @@ -96,8 +98,10 @@ func TestRewardManager(t *testing.T) { admin := testutils.NewAuth(t, adminKey, chainID) type testCase struct { - name string - test func(t *testing.T, backend *sim.Backend, rewardManagerIntf *rewardmanagerbindings.IRewardManager) + name string + initialRewardConfig *rewardmanager.InitialRewardConfig // optional + backendOpts []func(*node.Config, *ethconfig.Config) // optional + test func(t *testing.T, backend *sim.Backend, rewardManagerIntf *rewardmanagerbindings.IRewardManager) } testCases := []testCase{ @@ -259,11 +263,42 @@ func TestRewardManager(t *testing.T) { "reward recipient balance should have increased from fees") }, }, + { + name: "fees should go to coinbase when allowFeeRecipients is enabled", + initialRewardConfig: &rewardmanager.InitialRewardConfig{AllowFeeRecipients: true}, + backendOpts: []func(*node.Config, *ethconfig.Config){ + sim.WithEtherbase(crypto.PubkeyToAddress(unprivilegedKey.PublicKey)), // use unprivilegedAddress as coinbase + }, + test: func(t *testing.T, backend *sim.Backend, _ *rewardmanagerbindings.IRewardManager) { + client := backend.Client() + coinbaseAddr := unprivilegedAddress + + _, testContract := deployRewardManagerTest(t, backend, admin) + + isAllowed, err := testContract.AreFeeRecipientsAllowed(nil) + require.NoError(t, err) + require.True(t, isAllowed, "fee recipients should be allowed") + + initialCoinbaseBalance, err := client.BalanceAt(t.Context(), coinbaseAddr, nil) + require.NoError(t, err) + + // The fees from this transaction should go to the coinbase address + tx := SendSimpleTx(t, backend, adminKey) + testutils.WaitReceiptSuccessful(t, backend, tx) + + newCoinbaseBalance, err := client.BalanceAt(t.Context(), coinbaseAddr, nil) + require.NoError(t, err) + + require.Positive(t, newCoinbaseBalance.Cmp(initialCoinbaseBalance), + "coinbase balance should have increased from fees") + }, + }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := testutils.NewBackendWithPrecompile(t, rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), adminAddress, unprivilegedAddress) + cfg := rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, tc.initialRewardConfig) + backend := testutils.NewBackendWithPrecompileAndOptions(t, cfg, []common.Address{adminAddress, unprivilegedAddress}, tc.backendOpts...) defer backend.Close() rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 8cce014eed..d080029cee 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -13,6 +13,8 @@ import ( "github.com/stretchr/testify/require" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/eth/ethconfig" + "github.com/ava-labs/subnet-evm/node" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/params/extras" "github.com/ava-labs/subnet-evm/precompile/precompileconfig" @@ -31,6 +33,14 @@ func NewAuth(t *testing.T, key *ecdsa.PrivateKey, chainID *big.Int) *bind.Transa // NewBackendWithPrecompile creates a simulated backend with the given precompile enabled // at genesis and funds the specified addresses with 1 ETH each. func NewBackendWithPrecompile(t *testing.T, precompileCfg precompileconfig.Config, fundedAddrs ...common.Address) *sim.Backend { + t.Helper() + return NewBackendWithPrecompileAndOptions(t, precompileCfg, fundedAddrs) +} + +// NewBackendWithPrecompileAndOptions creates a simulated backend with the given precompile enabled +// at genesis and funds the specified addresses with 1 ETH each. Additional options can be passed +// to configure the backend. +func NewBackendWithPrecompileAndOptions(t *testing.T, precompileCfg precompileconfig.Config, fundedAddrs []common.Address, opts ...func(*node.Config, *ethconfig.Config)) *sim.Backend { t.Helper() chainCfg := params.Copy(params.TestChainConfig) params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ @@ -42,7 +52,8 @@ func NewBackendWithPrecompile(t *testing.T, precompileCfg precompileconfig.Confi genesisAlloc[addr] = types.Account{Balance: big.NewInt(1000000000000000000)} } - return sim.NewBackend(genesisAlloc, sim.WithChainConfig(&chainCfg)) + allOpts := append([]func(*node.Config, *ethconfig.Config){sim.WithChainConfig(&chainCfg)}, opts...) + return sim.NewBackend(genesisAlloc, allOpts...) } // WaitReceipt commits the simulated backend and waits for the transaction receipt. From 31edb020a6619084edd318a0f6db7a21649a4676 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:55:41 -0500 Subject: [PATCH 36/73] feat: warp bindings test --- contracts/bindings/gen_examplewarp.go | 369 ------------- contracts/contracts/ExampleWarp.sol | 58 --- .../contracts/interfaces/IWarpMessenger.sol | 48 -- contracts/test/utils.ts | 132 ----- contracts/test/warp.ts | 40 -- .../warp/warptest/bindings/IWarpMessenger.sol | 56 ++ .../warp/warptest/bindings/compile.go | 12 + .../bindings/gen_iwarpmessenger_binding.go | 490 ++++++++++++++++++ tests/warp/warp_test.go | 127 +++-- 9 files changed, 646 insertions(+), 686 deletions(-) delete mode 100644 contracts/bindings/gen_examplewarp.go delete mode 100644 contracts/contracts/ExampleWarp.sol delete mode 100644 contracts/contracts/interfaces/IWarpMessenger.sol delete mode 100644 contracts/test/utils.ts delete mode 100644 contracts/test/warp.ts create mode 100644 precompile/contracts/warp/warptest/bindings/IWarpMessenger.sol create mode 100644 precompile/contracts/warp/warptest/bindings/compile.go create mode 100644 precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go diff --git a/contracts/bindings/gen_examplewarp.go b/contracts/bindings/gen_examplewarp.go deleted file mode 100644 index fa0533458f..0000000000 --- a/contracts/bindings/gen_examplewarp.go +++ /dev/null @@ -1,369 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package bindings - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ava-labs/libevm" - "github.com/ava-labs/libevm/accounts/abi" - "github.com/ava-labs/libevm/accounts/abi/bind" - "github.com/ava-labs/libevm/common" - "github.com/ava-labs/libevm/core/types" - "github.com/ava-labs/libevm/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// ExampleWarpMetaData contains all meta data concerning the ExampleWarp contract. -var ExampleWarpMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"sendWarpMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockchainID\",\"type\":\"bytes32\"}],\"name\":\"validateGetBlockchainID\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"validateInvalidWarpBlockHash\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"validateInvalidWarpMessage\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"validateWarpBlockHash\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"validateWarpMessage\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60806040527302000000000000000000000000000000000000055f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503480156061575f5ffd5b50610d158061006f5f395ff3fe608060405234801561000f575f5ffd5b5060043610610060575f3560e01c806315f0c959146100645780635bd05f061461008057806377ca84db1461009c578063e519286f146100b8578063ee5b48eb146100d4578063f25ec06a146100f0575b5f5ffd5b61007e60048036038101906100799190610672565b61010c565b005b61009a60048036038101906100959190610791565b6101a6565b005b6100b660048036038101906100b19190610815565b6102cf565b005b6100d260048036038101906100cd9190610840565b61039d565b005b6100ee60048036038101906100e99190610890565b610468565b005b61010a60048036038101906101059190610815565b610508565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610175573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061019991906108ef565b81146101a3575f5ffd5b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350886040518263ffffffff1660e01b81526004016102019190610929565b5f60405180830381865afa15801561021b573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906102439190610b48565b9150915080610250575f5ffd5b85825f01511461025e575f5ffd5b8473ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff1614610299575f5ffd5b83836040516102a9929190610bde565b6040518091039020826040015180519060200120146102c6575f5ffd5b50505050505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929846040518263ffffffff1660e01b815260040161032a9190610929565b606060405180830381865afa158015610345573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103699190610c43565b915091508015610377575f5ffd5b5f5f1b825f015114610387575f5ffd5b5f5f1b826020015114610398575f5ffd5b505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929866040518263ffffffff1660e01b81526004016103f89190610929565b606060405180830381865afa158015610413573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104379190610c43565b9150915080610444575f5ffd5b83825f015114610452575f5ffd5b82826020015114610461575f5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee5b48eb83836040518363ffffffff1660e01b81526004016104c3929190610cbd565b6020604051808303815f875af11580156104df573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061050391906108ef565b505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350846040518263ffffffff1660e01b81526004016105639190610929565b5f60405180830381865afa15801561057d573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906105a59190610b48565b9150915080156105b3575f5ffd5b5f5f1b825f0151146105c3575f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff16826020015173ffffffffffffffffffffffffffffffffffffffff16146105fe575f5ffd5b60405180602001604052805f8152508051906020012082604001518051906020012014610629575f5ffd5b505050565b5f604051905090565b5f5ffd5b5f5ffd5b5f819050919050565b6106518161063f565b811461065b575f5ffd5b50565b5f8135905061066c81610648565b92915050565b5f6020828403121561068757610686610637565b5b5f6106948482850161065e565b91505092915050565b5f63ffffffff82169050919050565b6106b58161069d565b81146106bf575f5ffd5b50565b5f813590506106d0816106ac565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6106ff826106d6565b9050919050565b61070f816106f5565b8114610719575f5ffd5b50565b5f8135905061072a81610706565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261075157610750610730565b5b8235905067ffffffffffffffff81111561076e5761076d610734565b5b60208301915083600182028301111561078a57610789610738565b5b9250929050565b5f5f5f5f5f608086880312156107aa576107a9610637565b5b5f6107b7888289016106c2565b95505060206107c88882890161065e565b94505060406107d98882890161071c565b935050606086013567ffffffffffffffff8111156107fa576107f961063b565b5b6108068882890161073c565b92509250509295509295909350565b5f6020828403121561082a57610829610637565b5b5f610837848285016106c2565b91505092915050565b5f5f5f6060848603121561085757610856610637565b5b5f610864868287016106c2565b93505060206108758682870161065e565b92505060406108868682870161065e565b9150509250925092565b5f5f602083850312156108a6576108a5610637565b5b5f83013567ffffffffffffffff8111156108c3576108c261063b565b5b6108cf8582860161073c565b92509250509250929050565b5f815190506108e981610648565b92915050565b5f6020828403121561090457610903610637565b5b5f610911848285016108db565b91505092915050565b6109238161069d565b82525050565b5f60208201905061093c5f83018461091a565b92915050565b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61098c82610946565b810181811067ffffffffffffffff821117156109ab576109aa610956565b5b80604052505050565b5f6109bd61062e565b90506109c98282610983565b919050565b5f5ffd5b5f815190506109e081610706565b92915050565b5f5ffd5b5f67ffffffffffffffff821115610a0457610a03610956565b5b610a0d82610946565b9050602081019050919050565b8281835e5f83830152505050565b5f610a3a610a35846109ea565b6109b4565b905082815260208101848484011115610a5657610a556109e6565b5b610a61848285610a1a565b509392505050565b5f82601f830112610a7d57610a7c610730565b5b8151610a8d848260208601610a28565b91505092915050565b5f60608284031215610aab57610aaa610942565b5b610ab560606109b4565b90505f610ac4848285016108db565b5f830152506020610ad7848285016109d2565b602083015250604082015167ffffffffffffffff811115610afb57610afa6109ce565b5b610b0784828501610a69565b60408301525092915050565b5f8115159050919050565b610b2781610b13565b8114610b31575f5ffd5b50565b5f81519050610b4281610b1e565b92915050565b5f5f60408385031215610b5e57610b5d610637565b5b5f83015167ffffffffffffffff811115610b7b57610b7a61063b565b5b610b8785828601610a96565b9250506020610b9885828601610b34565b9150509250929050565b5f81905092915050565b828183375f83830152505050565b5f610bc58385610ba2565b9350610bd2838584610bac565b82840190509392505050565b5f610bea828486610bba565b91508190509392505050565b5f60408284031215610c0b57610c0a610942565b5b610c1560406109b4565b90505f610c24848285016108db565b5f830152506020610c37848285016108db565b60208301525092915050565b5f5f60608385031215610c5957610c58610637565b5b5f610c6685828601610bf6565b9250506040610c7785828601610b34565b9150509250929050565b5f82825260208201905092915050565b5f610c9c8385610c81565b9350610ca9838584610bac565b610cb283610946565b840190509392505050565b5f6020820190508181035f830152610cd6818486610c91565b9050939250505056fea26469706673582212203aa2f3f51e0713d8d1f446f157ef2504c89940d33ec5cba0e160a28e6af1a1b664736f6c634300081e0033", -} - -// ExampleWarpABI is the input ABI used to generate the binding from. -// Deprecated: Use ExampleWarpMetaData.ABI instead. -var ExampleWarpABI = ExampleWarpMetaData.ABI - -// ExampleWarpBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use ExampleWarpMetaData.Bin instead. -var ExampleWarpBin = ExampleWarpMetaData.Bin - -// DeployExampleWarp deploys a new Ethereum contract, binding an instance of ExampleWarp to it. -func DeployExampleWarp(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ExampleWarp, error) { - parsed, err := ExampleWarpMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ExampleWarpBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &ExampleWarp{ExampleWarpCaller: ExampleWarpCaller{contract: contract}, ExampleWarpTransactor: ExampleWarpTransactor{contract: contract}, ExampleWarpFilterer: ExampleWarpFilterer{contract: contract}}, nil -} - -// ExampleWarp is an auto generated Go binding around an Ethereum contract. -type ExampleWarp struct { - ExampleWarpCaller // Read-only binding to the contract - ExampleWarpTransactor // Write-only binding to the contract - ExampleWarpFilterer // Log filterer for contract events -} - -// ExampleWarpCaller is an auto generated read-only Go binding around an Ethereum contract. -type ExampleWarpCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleWarpTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ExampleWarpTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleWarpFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ExampleWarpFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ExampleWarpSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ExampleWarpSession struct { - Contract *ExampleWarp // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ExampleWarpCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ExampleWarpCallerSession struct { - Contract *ExampleWarpCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ExampleWarpTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ExampleWarpTransactorSession struct { - Contract *ExampleWarpTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ExampleWarpRaw is an auto generated low-level Go binding around an Ethereum contract. -type ExampleWarpRaw struct { - Contract *ExampleWarp // Generic contract binding to access the raw methods on -} - -// ExampleWarpCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ExampleWarpCallerRaw struct { - Contract *ExampleWarpCaller // Generic read-only contract binding to access the raw methods on -} - -// ExampleWarpTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ExampleWarpTransactorRaw struct { - Contract *ExampleWarpTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewExampleWarp creates a new instance of ExampleWarp, bound to a specific deployed contract. -func NewExampleWarp(address common.Address, backend bind.ContractBackend) (*ExampleWarp, error) { - contract, err := bindExampleWarp(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ExampleWarp{ExampleWarpCaller: ExampleWarpCaller{contract: contract}, ExampleWarpTransactor: ExampleWarpTransactor{contract: contract}, ExampleWarpFilterer: ExampleWarpFilterer{contract: contract}}, nil -} - -// NewExampleWarpCaller creates a new read-only instance of ExampleWarp, bound to a specific deployed contract. -func NewExampleWarpCaller(address common.Address, caller bind.ContractCaller) (*ExampleWarpCaller, error) { - contract, err := bindExampleWarp(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ExampleWarpCaller{contract: contract}, nil -} - -// NewExampleWarpTransactor creates a new write-only instance of ExampleWarp, bound to a specific deployed contract. -func NewExampleWarpTransactor(address common.Address, transactor bind.ContractTransactor) (*ExampleWarpTransactor, error) { - contract, err := bindExampleWarp(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ExampleWarpTransactor{contract: contract}, nil -} - -// NewExampleWarpFilterer creates a new log filterer instance of ExampleWarp, bound to a specific deployed contract. -func NewExampleWarpFilterer(address common.Address, filterer bind.ContractFilterer) (*ExampleWarpFilterer, error) { - contract, err := bindExampleWarp(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ExampleWarpFilterer{contract: contract}, nil -} - -// bindExampleWarp binds a generic wrapper to an already deployed contract. -func bindExampleWarp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ExampleWarpMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ExampleWarp *ExampleWarpRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ExampleWarp.Contract.ExampleWarpCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ExampleWarp *ExampleWarpRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleWarp.Contract.ExampleWarpTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ExampleWarp *ExampleWarpRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ExampleWarp.Contract.ExampleWarpTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ExampleWarp *ExampleWarpCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ExampleWarp.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ExampleWarp *ExampleWarpTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ExampleWarp.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ExampleWarp *ExampleWarpTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ExampleWarp.Contract.contract.Transact(opts, method, params...) -} - -// ValidateGetBlockchainID is a free data retrieval call binding the contract method 0x15f0c959. -// -// Solidity: function validateGetBlockchainID(bytes32 blockchainID) view returns() -func (_ExampleWarp *ExampleWarpCaller) ValidateGetBlockchainID(opts *bind.CallOpts, blockchainID [32]byte) error { - var out []interface{} - err := _ExampleWarp.contract.Call(opts, &out, "validateGetBlockchainID", blockchainID) - - if err != nil { - return err - } - - return err - -} - -// ValidateGetBlockchainID is a free data retrieval call binding the contract method 0x15f0c959. -// -// Solidity: function validateGetBlockchainID(bytes32 blockchainID) view returns() -func (_ExampleWarp *ExampleWarpSession) ValidateGetBlockchainID(blockchainID [32]byte) error { - return _ExampleWarp.Contract.ValidateGetBlockchainID(&_ExampleWarp.CallOpts, blockchainID) -} - -// ValidateGetBlockchainID is a free data retrieval call binding the contract method 0x15f0c959. -// -// Solidity: function validateGetBlockchainID(bytes32 blockchainID) view returns() -func (_ExampleWarp *ExampleWarpCallerSession) ValidateGetBlockchainID(blockchainID [32]byte) error { - return _ExampleWarp.Contract.ValidateGetBlockchainID(&_ExampleWarp.CallOpts, blockchainID) -} - -// ValidateInvalidWarpBlockHash is a free data retrieval call binding the contract method 0x77ca84db. -// -// Solidity: function validateInvalidWarpBlockHash(uint32 index) view returns() -func (_ExampleWarp *ExampleWarpCaller) ValidateInvalidWarpBlockHash(opts *bind.CallOpts, index uint32) error { - var out []interface{} - err := _ExampleWarp.contract.Call(opts, &out, "validateInvalidWarpBlockHash", index) - - if err != nil { - return err - } - - return err - -} - -// ValidateInvalidWarpBlockHash is a free data retrieval call binding the contract method 0x77ca84db. -// -// Solidity: function validateInvalidWarpBlockHash(uint32 index) view returns() -func (_ExampleWarp *ExampleWarpSession) ValidateInvalidWarpBlockHash(index uint32) error { - return _ExampleWarp.Contract.ValidateInvalidWarpBlockHash(&_ExampleWarp.CallOpts, index) -} - -// ValidateInvalidWarpBlockHash is a free data retrieval call binding the contract method 0x77ca84db. -// -// Solidity: function validateInvalidWarpBlockHash(uint32 index) view returns() -func (_ExampleWarp *ExampleWarpCallerSession) ValidateInvalidWarpBlockHash(index uint32) error { - return _ExampleWarp.Contract.ValidateInvalidWarpBlockHash(&_ExampleWarp.CallOpts, index) -} - -// ValidateInvalidWarpMessage is a free data retrieval call binding the contract method 0xf25ec06a. -// -// Solidity: function validateInvalidWarpMessage(uint32 index) view returns() -func (_ExampleWarp *ExampleWarpCaller) ValidateInvalidWarpMessage(opts *bind.CallOpts, index uint32) error { - var out []interface{} - err := _ExampleWarp.contract.Call(opts, &out, "validateInvalidWarpMessage", index) - - if err != nil { - return err - } - - return err - -} - -// ValidateInvalidWarpMessage is a free data retrieval call binding the contract method 0xf25ec06a. -// -// Solidity: function validateInvalidWarpMessage(uint32 index) view returns() -func (_ExampleWarp *ExampleWarpSession) ValidateInvalidWarpMessage(index uint32) error { - return _ExampleWarp.Contract.ValidateInvalidWarpMessage(&_ExampleWarp.CallOpts, index) -} - -// ValidateInvalidWarpMessage is a free data retrieval call binding the contract method 0xf25ec06a. -// -// Solidity: function validateInvalidWarpMessage(uint32 index) view returns() -func (_ExampleWarp *ExampleWarpCallerSession) ValidateInvalidWarpMessage(index uint32) error { - return _ExampleWarp.Contract.ValidateInvalidWarpMessage(&_ExampleWarp.CallOpts, index) -} - -// ValidateWarpBlockHash is a free data retrieval call binding the contract method 0xe519286f. -// -// Solidity: function validateWarpBlockHash(uint32 index, bytes32 sourceChainID, bytes32 blockHash) view returns() -func (_ExampleWarp *ExampleWarpCaller) ValidateWarpBlockHash(opts *bind.CallOpts, index uint32, sourceChainID [32]byte, blockHash [32]byte) error { - var out []interface{} - err := _ExampleWarp.contract.Call(opts, &out, "validateWarpBlockHash", index, sourceChainID, blockHash) - - if err != nil { - return err - } - - return err - -} - -// ValidateWarpBlockHash is a free data retrieval call binding the contract method 0xe519286f. -// -// Solidity: function validateWarpBlockHash(uint32 index, bytes32 sourceChainID, bytes32 blockHash) view returns() -func (_ExampleWarp *ExampleWarpSession) ValidateWarpBlockHash(index uint32, sourceChainID [32]byte, blockHash [32]byte) error { - return _ExampleWarp.Contract.ValidateWarpBlockHash(&_ExampleWarp.CallOpts, index, sourceChainID, blockHash) -} - -// ValidateWarpBlockHash is a free data retrieval call binding the contract method 0xe519286f. -// -// Solidity: function validateWarpBlockHash(uint32 index, bytes32 sourceChainID, bytes32 blockHash) view returns() -func (_ExampleWarp *ExampleWarpCallerSession) ValidateWarpBlockHash(index uint32, sourceChainID [32]byte, blockHash [32]byte) error { - return _ExampleWarp.Contract.ValidateWarpBlockHash(&_ExampleWarp.CallOpts, index, sourceChainID, blockHash) -} - -// ValidateWarpMessage is a free data retrieval call binding the contract method 0x5bd05f06. -// -// Solidity: function validateWarpMessage(uint32 index, bytes32 sourceChainID, address originSenderAddress, bytes payload) view returns() -func (_ExampleWarp *ExampleWarpCaller) ValidateWarpMessage(opts *bind.CallOpts, index uint32, sourceChainID [32]byte, originSenderAddress common.Address, payload []byte) error { - var out []interface{} - err := _ExampleWarp.contract.Call(opts, &out, "validateWarpMessage", index, sourceChainID, originSenderAddress, payload) - - if err != nil { - return err - } - - return err - -} - -// ValidateWarpMessage is a free data retrieval call binding the contract method 0x5bd05f06. -// -// Solidity: function validateWarpMessage(uint32 index, bytes32 sourceChainID, address originSenderAddress, bytes payload) view returns() -func (_ExampleWarp *ExampleWarpSession) ValidateWarpMessage(index uint32, sourceChainID [32]byte, originSenderAddress common.Address, payload []byte) error { - return _ExampleWarp.Contract.ValidateWarpMessage(&_ExampleWarp.CallOpts, index, sourceChainID, originSenderAddress, payload) -} - -// ValidateWarpMessage is a free data retrieval call binding the contract method 0x5bd05f06. -// -// Solidity: function validateWarpMessage(uint32 index, bytes32 sourceChainID, address originSenderAddress, bytes payload) view returns() -func (_ExampleWarp *ExampleWarpCallerSession) ValidateWarpMessage(index uint32, sourceChainID [32]byte, originSenderAddress common.Address, payload []byte) error { - return _ExampleWarp.Contract.ValidateWarpMessage(&_ExampleWarp.CallOpts, index, sourceChainID, originSenderAddress, payload) -} - -// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. -// -// Solidity: function sendWarpMessage(bytes payload) returns() -func (_ExampleWarp *ExampleWarpTransactor) SendWarpMessage(opts *bind.TransactOpts, payload []byte) (*types.Transaction, error) { - return _ExampleWarp.contract.Transact(opts, "sendWarpMessage", payload) -} - -// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. -// -// Solidity: function sendWarpMessage(bytes payload) returns() -func (_ExampleWarp *ExampleWarpSession) SendWarpMessage(payload []byte) (*types.Transaction, error) { - return _ExampleWarp.Contract.SendWarpMessage(&_ExampleWarp.TransactOpts, payload) -} - -// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. -// -// Solidity: function sendWarpMessage(bytes payload) returns() -func (_ExampleWarp *ExampleWarpTransactorSession) SendWarpMessage(payload []byte) (*types.Transaction, error) { - return _ExampleWarp.Contract.SendWarpMessage(&_ExampleWarp.TransactOpts, payload) -} diff --git a/contracts/contracts/ExampleWarp.sol b/contracts/contracts/ExampleWarp.sol deleted file mode 100644 index 9c2d8f560a..0000000000 --- a/contracts/contracts/ExampleWarp.sol +++ /dev/null @@ -1,58 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; -pragma experimental ABIEncoderV2; - -import "./interfaces/IWarpMessenger.sol"; - -contract ExampleWarp { - address constant WARP_ADDRESS = 0x0200000000000000000000000000000000000005; - IWarpMessenger warp = IWarpMessenger(WARP_ADDRESS); - - // sendWarpMessage sends a warp message containing the payload - function sendWarpMessage(bytes calldata payload) external { - warp.sendWarpMessage(payload); - } - - // validateWarpMessage retrieves the warp message attached to the transaction and verifies all of its attributes. - function validateWarpMessage( - uint32 index, - bytes32 sourceChainID, - address originSenderAddress, - bytes calldata payload - ) external view { - (WarpMessage memory message, bool valid) = warp.getVerifiedWarpMessage(index); - require(valid); - require(message.sourceChainID == sourceChainID); - require(message.originSenderAddress == originSenderAddress); - require(keccak256(message.payload) == keccak256(payload)); - } - - function validateInvalidWarpMessage(uint32 index) external view { - (WarpMessage memory message, bool valid) = warp.getVerifiedWarpMessage(index); - require(!valid); - require(message.sourceChainID == bytes32(0)); - require(message.originSenderAddress == address(0)); - require(keccak256(message.payload) == keccak256(bytes(""))); - } - - // validateWarpBlockHash retrieves the warp block hash attached to the transaction and verifies it matches the - // expected block hash. - function validateWarpBlockHash(uint32 index, bytes32 sourceChainID, bytes32 blockHash) external view { - (WarpBlockHash memory warpBlockHash, bool valid) = warp.getVerifiedWarpBlockHash(index); - require(valid); - require(warpBlockHash.sourceChainID == sourceChainID); - require(warpBlockHash.blockHash == blockHash); - } - - function validateInvalidWarpBlockHash(uint32 index) external view { - (WarpBlockHash memory warpBlockHash, bool valid) = warp.getVerifiedWarpBlockHash(index); - require(!valid); - require(warpBlockHash.sourceChainID == bytes32(0)); - require(warpBlockHash.blockHash == bytes32(0)); - } - - // validateGetBlockchainID checks that the blockchainID returned by warp matches the argument - function validateGetBlockchainID(bytes32 blockchainID) external view { - require(blockchainID == warp.getBlockchainID()); - } -} diff --git a/contracts/contracts/interfaces/IWarpMessenger.sol b/contracts/contracts/interfaces/IWarpMessenger.sol deleted file mode 100644 index 7f96b34070..0000000000 --- a/contracts/contracts/interfaces/IWarpMessenger.sol +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.24; - -struct WarpMessage { - bytes32 sourceChainID; - address originSenderAddress; - bytes payload; -} - -struct WarpBlockHash { - bytes32 sourceChainID; - bytes32 blockHash; -} - -interface IWarpMessenger { - event SendWarpMessage(address indexed sender, bytes32 indexed messageID, bytes message); - - // sendWarpMessage emits a request for the subnet to send a warp message from [msg.sender] - // with the specified parameters. - // This emits a SendWarpMessage log from the precompile. When the corresponding block is accepted - // the Accept hook of the Warp precompile is invoked with all accepted logs emitted by the Warp - // precompile. - // Each validator then adds the UnsignedWarpMessage encoded in the log to the set of messages - // it is willing to sign for an off-chain relayer to aggregate Warp signatures. - function sendWarpMessage(bytes calldata payload) external returns (bytes32 messageID); - - // getVerifiedWarpMessage parses the pre-verified warp message in the - // predicate storage slots as a WarpMessage and returns it to the caller. - // If the message exists and passes verification, returns the verified message - // and true. - // Otherwise, returns false and the empty value for the message. - function getVerifiedWarpMessage(uint32 index) external view returns (WarpMessage calldata message, bool valid); - - // getVerifiedWarpBlockHash parses the pre-verified WarpBlockHash message in the - // predicate storage slots as a WarpBlockHash message and returns it to the caller. - // If the message exists and passes verification, returns the verified message - // and true. - // Otherwise, returns false and the empty value for the message. - function getVerifiedWarpBlockHash( - uint32 index - ) external view returns (WarpBlockHash calldata warpBlockHash, bool valid); - - // getBlockchainID returns the snow.Context BlockchainID of this chain. - // This blockchainID is the hash of the transaction that created this blockchain on the P-Chain - // and is not related to the Ethereum ChainID. - function getBlockchainID() external view returns (bytes32 blockchainID); -} diff --git a/contracts/test/utils.ts b/contracts/test/utils.ts deleted file mode 100644 index aa85b66733..0000000000 --- a/contracts/test/utils.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { ethers } from "hardhat" -import { Overrides } from "ethers" -import assert from "assert" - -/* - * - * The `test` function is a wrapper around Mocha's `it` function. It provides a normalized framework for running the - * majority of your test assertions inside of a smart-contract, using `DS-Test`. - * The API can be used as follows (all of the examples are equivalent): - * ```ts - * test("", "") - * test("", [""]) - * test("", { method: "", overrides: {}, shouldFail: false, debug: false }) - * test("", [{ method: "", overrides: {}, shouldFail: false, debug: false }]) - * test("", [{ method: "", shouldFail: false, debug: false }], {}) - * ``` - * Many contract functions can be called as a part of the same test: - * ```ts - * test("", ["", "", ""]) - * ``` - * Individual test functions can describe their own overrides with the `overrides` property. - * If an object is passed in as the third argument to `test`, it will be used as the default overrides for all test - * functions. - * The following are equivalent: - * ```ts - * test("", [{ method: "", overrides: { from: "0x123" } }]) - * test("", [{ method: "" }], { from: "0x123" }) - * ``` - * In the above cases, the `from` override must be a signer. - * The `shouldFail` property can be used to indicate that the test function should fail. This should be used sparingly - * as it is not possible to match on the failure reason. - * Furthermore, the `debug` property can be used to print any thrown errors when attempting to - * send a transaction or while waiting for the transaction to be confirmed (the transaction is the smart contract call). - * `debug` will also cause any parseable event logs to be printed that start with the `log_` prefix. - * `DSTest` contracts have several options for emitting `log_` events. - * - */ - -// Below are the types that help define all the different ways to call `test` -type FnNameOrObject = string | string[] | MethodObject | MethodObject[] - -// Limit `from` property to be a `string` instead of `string | Promise` -type CallOverrides = Overrides & { from?: string } - -type MethodObject = { method: string, debug?: boolean, overrides?: CallOverrides, shouldFail?: boolean } - -// This type is after all default values have been applied -type MethodWithDebugAndOverrides = MethodObject & { debug: boolean, overrides: CallOverrides, shouldFail: boolean } - -// `test` is used very similarly to `it` from Mocha -export const test = (name, fnNameOrObject, overrides = {}) => it(name, buildTestFn(fnNameOrObject, overrides)) -// `test.only` is used very similarly to `it.only` from Mocha, it will isolate all tests marked with `test.only` -test.only = (name, fnNameOrObject, overrides = {}) => it.only(name, buildTestFn(fnNameOrObject, overrides)) -// `test.debug` is used to apply `debug: true` to all DSTest contract method calls in the test -test.debug = (name, fnNameOrObject, overrides = {}) => it.only(name, buildTestFn(fnNameOrObject, overrides, true)) -// `test.skip` is used very similarly to `it.skip` from Mocha, it will skip all tests marked with `test.skip` -test.skip = (name, fnNameOrObject, overrides = {}) => it.skip(name, buildTestFn(fnNameOrObject, overrides)) - -// `buildTestFn` is a higher-order function. It returns a function that can be used as the test function for `it` -const buildTestFn = (fnNameOrObject: FnNameOrObject, overrides = {}, debug = false) => { - // normalize the input to an array of objects - const fnObjects: MethodWithDebugAndOverrides[] = (Array.isArray(fnNameOrObject) ? fnNameOrObject : [fnNameOrObject]).map(fnNameOrObject => { - fnNameOrObject = typeof fnNameOrObject === 'string' ? { method: fnNameOrObject } : fnNameOrObject - // assign all default values and overrides - fnNameOrObject.overrides = Object.assign({}, overrides, fnNameOrObject.overrides ?? {}) - fnNameOrObject.debug = fnNameOrObject.debug ?? debug - fnNameOrObject.shouldFail = fnNameOrObject.shouldFail ?? false - - return fnNameOrObject as MethodWithDebugAndOverrides - }) - - // only `step_` prefixed functions can be called on the `DSTest` contracts to clearly separate tests and helpers - assert(fnObjects.every(({ method }) => method.startsWith('step_')), "Solidity test functions must be prefixed with 'step_'") - - // return the test function that will be used by `it` - // this function must be defined with the `function` keyword so that `this` is bound to the Mocha context - return async function () { - // `Array.prototype.reduce` is used here to ensure that the test functions are called in order. - // Each test function waits for its predecessor to complete before starting - return fnObjects.reduce((p: Promise, fn) => p.then(async () => { - const contract = fn.overrides.from - ? this.testContract.connect(await ethers.getSigner(fn.overrides.from)) - : this.testContract - const tx = await contract[fn.method](fn.overrides).catch(err => { - if (fn.shouldFail) { - if (fn.debug){ - console.error(`smart contract call failed with error:\n${err}\n`) - } - - return { failed: true } - } - - console.error("smart contract call failed with error:", err) - throw err - }) - - // no more assertions necessary if the method-call should fail and did fail - if (tx.failed && fn.shouldFail) return - - const txReceipt = await tx.wait().catch(err => { - if (fn.debug) console.error(`tx failed with error:\n${err}\n`) - return err.receipt - }) - - // `txReceipt.status` will be `0` if the transaction failed. - // `contract.failed` will return `true` if any of the `DSTest` assertions failed. - const failed = txReceipt.status === 0 ? true : await contract.failed.staticCall() - if (fn.debug || failed) { - console.log('') - - if (!txReceipt.events) console.warn('WARNING: No parseable events found in tx-receipt\n') - - // If `DSTest` assertions failed, the contract will emit logs describing the assertion failure(s). - txReceipt - .events - ?.filter(event => fn.debug || event.event?.startsWith('log')) - .map(event => event.args?.forEach(arg => console.log(arg))) - - console.log('') - } - - assert(!failed, `${fn.method} failed`) - }), Promise.resolve()) - } -} - -export const Roles = { - None: 0, - Enabled: 1, - Admin: 2, - Manager: 3, -} diff --git a/contracts/test/warp.ts b/contracts/test/warp.ts deleted file mode 100644 index 32fb54da22..0000000000 --- a/contracts/test/warp.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. -// See the file LICENSE for licensing terms. - -import { expect } from "chai"; -import { ethers } from "hardhat"; -import { Contract, Signer } from "ethers"; -import { IWarpMessenger } from "typechain-types"; - -const WARP_ADDRESS = "0x0200000000000000000000000000000000000005"; -let senderAddress = process.env["SENDER_ADDRESS"]; -// Expected to be a hex string -let payload = process.env["PAYLOAD"]; -let expectedUnsignedMessage = process.env["EXPECTED_UNSIGNED_MESSAGE"]; -let sourceID = process.env["SOURCE_CHAIN_ID"]; - -describe("IWarpMessenger", function () { - let owner: Signer; - let contract: IWarpMessenger; - before(async function () { - owner = await ethers.getSigner(senderAddress); - contract = await ethers.getContractAt("IWarpMessenger", WARP_ADDRESS, owner) - }); - - it("contract should be to send warp message", async function () { - console.log(`Sending warp message with payload ${payload}, expected unsigned message ${expectedUnsignedMessage}`); - - // Get ID of payload by taking sha256 of unsigned message - let messageID = ethers.sha256(expectedUnsignedMessage); - let tx = await contract.sendWarpMessage(payload) - let receipt = await tx.wait() - await expect(receipt) - .to.emit(contract, 'SendWarpMessage') - .withArgs(senderAddress, messageID, expectedUnsignedMessage); - }) - - it("should be able to fetch correct blockchain ID", async function () { - let blockchainID = await contract.getBlockchainID(); - expect(blockchainID).to.be.equal(sourceID); - }) -}) diff --git a/precompile/contracts/warp/warptest/bindings/IWarpMessenger.sol b/precompile/contracts/warp/warptest/bindings/IWarpMessenger.sol new file mode 100644 index 0000000000..cbf1683cc2 --- /dev/null +++ b/precompile/contracts/warp/warptest/bindings/IWarpMessenger.sol @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.24; + +struct WarpMessage { + bytes32 sourceChainID; + address originSenderAddress; + bytes payload; +} + +struct WarpBlockHash { + bytes32 sourceChainID; + bytes32 blockHash; +} + +interface IWarpMessenger { + event SendWarpMessage( + address indexed sender, + bytes32 indexed messageID, + bytes message + ); + + // sendWarpMessage emits a request for the subnet to send a warp message from [msg.sender] + // with the specified parameters. + // This emits a SendWarpMessage log from the precompile. When the corresponding block is accepted + // the Accept hook of the Warp precompile is invoked with all accepted logs emitted by the Warp + // precompile. + // Each validator then adds the UnsignedWarpMessage encoded in the log to the set of messages + // it is willing to sign for an off-chain relayer to aggregate Warp signatures. + function sendWarpMessage( + bytes calldata payload + ) external returns (bytes32 messageID); + + // getVerifiedWarpMessage parses the pre-verified warp message in the + // predicate storage slots as a WarpMessage and returns it to the caller. + // If the message exists and passes verification, returns the verified message + // and true. + // Otherwise, returns false and the empty value for the message. + function getVerifiedWarpMessage( + uint32 index + ) external view returns (WarpMessage calldata message, bool valid); + + // getVerifiedWarpBlockHash parses the pre-verified WarpBlockHash message in the + // predicate storage slots as a WarpBlockHash message and returns it to the caller. + // If the message exists and passes verification, returns the verified message + // and true. + // Otherwise, returns false and the empty value for the message. + function getVerifiedWarpBlockHash( + uint32 index + ) external view returns (WarpBlockHash calldata warpBlockHash, bool valid); + + // getBlockchainID returns the snow.Context BlockchainID of this chain. + // This blockchainID is the hash of the transaction that created this blockchain on the P-Chain + // and is not related to the Ethereum ChainID. + function getBlockchainID() external view returns (bytes32 blockchainID); +} diff --git a/precompile/contracts/warp/warptest/bindings/compile.go b/precompile/contracts/warp/warptest/bindings/compile.go new file mode 100644 index 0000000000..2c9476a993 --- /dev/null +++ b/precompile/contracts/warp/warptest/bindings/compile.go @@ -0,0 +1,12 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package bindings + +// Step 1: Compile Solidity contracts to generate ABI and bin files +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --evm-version cancun IWarpMessenger.sol +// Step 2: Generate Go bindings from the compiled artifacts +//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IWarpMessenger --abi artifacts/IWarpMessenger.abi --bin artifacts/IWarpMessenger.bin --out gen_iwarpmessenger_binding.go +// Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. +//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_iwarpmessenger_binding.go && rm -f gen_iwarpmessenger_binding.go.bak" diff --git a/precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go b/precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go new file mode 100644 index 0000000000..1cf8d9b8f3 --- /dev/null +++ b/precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go @@ -0,0 +1,490 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ava-labs/libevm" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// WarpBlockHash is an auto generated low-level Go binding around an user-defined struct. +type WarpBlockHash struct { + SourceChainID [32]byte + BlockHash [32]byte +} + +// WarpMessage is an auto generated low-level Go binding around an user-defined struct. +type WarpMessage struct { + SourceChainID [32]byte + OriginSenderAddress common.Address + Payload []byte +} + +// IWarpMessengerMetaData contains all meta data concerning the IWarpMessenger contract. +var IWarpMessengerMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"messageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SendWarpMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"getBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockchainID\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpBlockHash\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"internalType\":\"structWarpBlockHash\",\"name\":\"warpBlockHash\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpMessage\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"internalType\":\"structWarpMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"sendWarpMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// IWarpMessengerABI is the input ABI used to generate the binding from. +// Deprecated: Use IWarpMessengerMetaData.ABI instead. +var IWarpMessengerABI = IWarpMessengerMetaData.ABI + +// IWarpMessenger is an auto generated Go binding around an Ethereum contract. +type IWarpMessenger struct { + IWarpMessengerCaller // Read-only binding to the contract + IWarpMessengerTransactor // Write-only binding to the contract + IWarpMessengerFilterer // Log filterer for contract events +} + +// IWarpMessengerCaller is an auto generated read-only Go binding around an Ethereum contract. +type IWarpMessengerCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IWarpMessengerTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IWarpMessengerTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IWarpMessengerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IWarpMessengerFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IWarpMessengerSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IWarpMessengerSession struct { + Contract *IWarpMessenger // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IWarpMessengerCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IWarpMessengerCallerSession struct { + Contract *IWarpMessengerCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IWarpMessengerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IWarpMessengerTransactorSession struct { + Contract *IWarpMessengerTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IWarpMessengerRaw is an auto generated low-level Go binding around an Ethereum contract. +type IWarpMessengerRaw struct { + Contract *IWarpMessenger // Generic contract binding to access the raw methods on +} + +// IWarpMessengerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IWarpMessengerCallerRaw struct { + Contract *IWarpMessengerCaller // Generic read-only contract binding to access the raw methods on +} + +// IWarpMessengerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IWarpMessengerTransactorRaw struct { + Contract *IWarpMessengerTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIWarpMessenger creates a new instance of IWarpMessenger, bound to a specific deployed contract. +func NewIWarpMessenger(address common.Address, backend bind.ContractBackend) (*IWarpMessenger, error) { + contract, err := bindIWarpMessenger(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IWarpMessenger{IWarpMessengerCaller: IWarpMessengerCaller{contract: contract}, IWarpMessengerTransactor: IWarpMessengerTransactor{contract: contract}, IWarpMessengerFilterer: IWarpMessengerFilterer{contract: contract}}, nil +} + +// NewIWarpMessengerCaller creates a new read-only instance of IWarpMessenger, bound to a specific deployed contract. +func NewIWarpMessengerCaller(address common.Address, caller bind.ContractCaller) (*IWarpMessengerCaller, error) { + contract, err := bindIWarpMessenger(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IWarpMessengerCaller{contract: contract}, nil +} + +// NewIWarpMessengerTransactor creates a new write-only instance of IWarpMessenger, bound to a specific deployed contract. +func NewIWarpMessengerTransactor(address common.Address, transactor bind.ContractTransactor) (*IWarpMessengerTransactor, error) { + contract, err := bindIWarpMessenger(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IWarpMessengerTransactor{contract: contract}, nil +} + +// NewIWarpMessengerFilterer creates a new log filterer instance of IWarpMessenger, bound to a specific deployed contract. +func NewIWarpMessengerFilterer(address common.Address, filterer bind.ContractFilterer) (*IWarpMessengerFilterer, error) { + contract, err := bindIWarpMessenger(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IWarpMessengerFilterer{contract: contract}, nil +} + +// bindIWarpMessenger binds a generic wrapper to an already deployed contract. +func bindIWarpMessenger(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IWarpMessengerMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IWarpMessenger *IWarpMessengerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IWarpMessenger.Contract.IWarpMessengerCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IWarpMessenger *IWarpMessengerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IWarpMessenger.Contract.IWarpMessengerTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IWarpMessenger *IWarpMessengerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IWarpMessenger.Contract.IWarpMessengerTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IWarpMessenger *IWarpMessengerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IWarpMessenger.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IWarpMessenger *IWarpMessengerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IWarpMessenger.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IWarpMessenger *IWarpMessengerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IWarpMessenger.Contract.contract.Transact(opts, method, params...) +} + +// GetBlockchainID is a free data retrieval call binding the contract method 0x4213cf78. +// +// Solidity: function getBlockchainID() view returns(bytes32 blockchainID) +func (_IWarpMessenger *IWarpMessengerCaller) GetBlockchainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _IWarpMessenger.contract.Call(opts, &out, "getBlockchainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetBlockchainID is a free data retrieval call binding the contract method 0x4213cf78. +// +// Solidity: function getBlockchainID() view returns(bytes32 blockchainID) +func (_IWarpMessenger *IWarpMessengerSession) GetBlockchainID() ([32]byte, error) { + return _IWarpMessenger.Contract.GetBlockchainID(&_IWarpMessenger.CallOpts) +} + +// GetBlockchainID is a free data retrieval call binding the contract method 0x4213cf78. +// +// Solidity: function getBlockchainID() view returns(bytes32 blockchainID) +func (_IWarpMessenger *IWarpMessengerCallerSession) GetBlockchainID() ([32]byte, error) { + return _IWarpMessenger.Contract.GetBlockchainID(&_IWarpMessenger.CallOpts) +} + +// GetVerifiedWarpBlockHash is a free data retrieval call binding the contract method 0xce7f5929. +// +// Solidity: function getVerifiedWarpBlockHash(uint32 index) view returns((bytes32,bytes32) warpBlockHash, bool valid) +func (_IWarpMessenger *IWarpMessengerCaller) GetVerifiedWarpBlockHash(opts *bind.CallOpts, index uint32) (struct { + WarpBlockHash WarpBlockHash + Valid bool +}, error) { + var out []interface{} + err := _IWarpMessenger.contract.Call(opts, &out, "getVerifiedWarpBlockHash", index) + + outstruct := new(struct { + WarpBlockHash WarpBlockHash + Valid bool + }) + if err != nil { + return *outstruct, err + } + + outstruct.WarpBlockHash = *abi.ConvertType(out[0], new(WarpBlockHash)).(*WarpBlockHash) + outstruct.Valid = *abi.ConvertType(out[1], new(bool)).(*bool) + + return *outstruct, err + +} + +// GetVerifiedWarpBlockHash is a free data retrieval call binding the contract method 0xce7f5929. +// +// Solidity: function getVerifiedWarpBlockHash(uint32 index) view returns((bytes32,bytes32) warpBlockHash, bool valid) +func (_IWarpMessenger *IWarpMessengerSession) GetVerifiedWarpBlockHash(index uint32) (struct { + WarpBlockHash WarpBlockHash + Valid bool +}, error) { + return _IWarpMessenger.Contract.GetVerifiedWarpBlockHash(&_IWarpMessenger.CallOpts, index) +} + +// GetVerifiedWarpBlockHash is a free data retrieval call binding the contract method 0xce7f5929. +// +// Solidity: function getVerifiedWarpBlockHash(uint32 index) view returns((bytes32,bytes32) warpBlockHash, bool valid) +func (_IWarpMessenger *IWarpMessengerCallerSession) GetVerifiedWarpBlockHash(index uint32) (struct { + WarpBlockHash WarpBlockHash + Valid bool +}, error) { + return _IWarpMessenger.Contract.GetVerifiedWarpBlockHash(&_IWarpMessenger.CallOpts, index) +} + +// GetVerifiedWarpMessage is a free data retrieval call binding the contract method 0x6f825350. +// +// Solidity: function getVerifiedWarpMessage(uint32 index) view returns((bytes32,address,bytes) message, bool valid) +func (_IWarpMessenger *IWarpMessengerCaller) GetVerifiedWarpMessage(opts *bind.CallOpts, index uint32) (struct { + Message WarpMessage + Valid bool +}, error) { + var out []interface{} + err := _IWarpMessenger.contract.Call(opts, &out, "getVerifiedWarpMessage", index) + + outstruct := new(struct { + Message WarpMessage + Valid bool + }) + if err != nil { + return *outstruct, err + } + + outstruct.Message = *abi.ConvertType(out[0], new(WarpMessage)).(*WarpMessage) + outstruct.Valid = *abi.ConvertType(out[1], new(bool)).(*bool) + + return *outstruct, err + +} + +// GetVerifiedWarpMessage is a free data retrieval call binding the contract method 0x6f825350. +// +// Solidity: function getVerifiedWarpMessage(uint32 index) view returns((bytes32,address,bytes) message, bool valid) +func (_IWarpMessenger *IWarpMessengerSession) GetVerifiedWarpMessage(index uint32) (struct { + Message WarpMessage + Valid bool +}, error) { + return _IWarpMessenger.Contract.GetVerifiedWarpMessage(&_IWarpMessenger.CallOpts, index) +} + +// GetVerifiedWarpMessage is a free data retrieval call binding the contract method 0x6f825350. +// +// Solidity: function getVerifiedWarpMessage(uint32 index) view returns((bytes32,address,bytes) message, bool valid) +func (_IWarpMessenger *IWarpMessengerCallerSession) GetVerifiedWarpMessage(index uint32) (struct { + Message WarpMessage + Valid bool +}, error) { + return _IWarpMessenger.Contract.GetVerifiedWarpMessage(&_IWarpMessenger.CallOpts, index) +} + +// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. +// +// Solidity: function sendWarpMessage(bytes payload) returns(bytes32 messageID) +func (_IWarpMessenger *IWarpMessengerTransactor) SendWarpMessage(opts *bind.TransactOpts, payload []byte) (*types.Transaction, error) { + return _IWarpMessenger.contract.Transact(opts, "sendWarpMessage", payload) +} + +// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. +// +// Solidity: function sendWarpMessage(bytes payload) returns(bytes32 messageID) +func (_IWarpMessenger *IWarpMessengerSession) SendWarpMessage(payload []byte) (*types.Transaction, error) { + return _IWarpMessenger.Contract.SendWarpMessage(&_IWarpMessenger.TransactOpts, payload) +} + +// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. +// +// Solidity: function sendWarpMessage(bytes payload) returns(bytes32 messageID) +func (_IWarpMessenger *IWarpMessengerTransactorSession) SendWarpMessage(payload []byte) (*types.Transaction, error) { + return _IWarpMessenger.Contract.SendWarpMessage(&_IWarpMessenger.TransactOpts, payload) +} + +// IWarpMessengerSendWarpMessageIterator is returned from FilterSendWarpMessage and is used to iterate over the raw logs and unpacked data for SendWarpMessage events raised by the IWarpMessenger contract. +type IWarpMessengerSendWarpMessageIterator struct { + Event *IWarpMessengerSendWarpMessage // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IWarpMessengerSendWarpMessageIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IWarpMessengerSendWarpMessage) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IWarpMessengerSendWarpMessage) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IWarpMessengerSendWarpMessageIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IWarpMessengerSendWarpMessageIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IWarpMessengerSendWarpMessage represents a SendWarpMessage event raised by the IWarpMessenger contract. +type IWarpMessengerSendWarpMessage struct { + Sender common.Address + MessageID [32]byte + Message []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterSendWarpMessage is a free log retrieval operation binding the contract event 0x56600c567728a800c0aa927500f831cb451df66a7af570eb4df4dfbf4674887d. +// +// Solidity: event SendWarpMessage(address indexed sender, bytes32 indexed messageID, bytes message) +func (_IWarpMessenger *IWarpMessengerFilterer) FilterSendWarpMessage(opts *bind.FilterOpts, sender []common.Address, messageID [][32]byte) (*IWarpMessengerSendWarpMessageIterator, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var messageIDRule []interface{} + for _, messageIDItem := range messageID { + messageIDRule = append(messageIDRule, messageIDItem) + } + + logs, sub, err := _IWarpMessenger.contract.FilterLogs(opts, "SendWarpMessage", senderRule, messageIDRule) + if err != nil { + return nil, err + } + return &IWarpMessengerSendWarpMessageIterator{contract: _IWarpMessenger.contract, event: "SendWarpMessage", logs: logs, sub: sub}, nil +} + +// WatchSendWarpMessage is a free log subscription operation binding the contract event 0x56600c567728a800c0aa927500f831cb451df66a7af570eb4df4dfbf4674887d. +// +// Solidity: event SendWarpMessage(address indexed sender, bytes32 indexed messageID, bytes message) +func (_IWarpMessenger *IWarpMessengerFilterer) WatchSendWarpMessage(opts *bind.WatchOpts, sink chan<- *IWarpMessengerSendWarpMessage, sender []common.Address, messageID [][32]byte) (event.Subscription, error) { + + var senderRule []interface{} + for _, senderItem := range sender { + senderRule = append(senderRule, senderItem) + } + var messageIDRule []interface{} + for _, messageIDItem := range messageID { + messageIDRule = append(messageIDRule, messageIDItem) + } + + logs, sub, err := _IWarpMessenger.contract.WatchLogs(opts, "SendWarpMessage", senderRule, messageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IWarpMessengerSendWarpMessage) + if err := _IWarpMessenger.contract.UnpackLog(event, "SendWarpMessage", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseSendWarpMessage is a log parse operation binding the contract event 0x56600c567728a800c0aa927500f831cb451df66a7af570eb4df4dfbf4674887d. +// +// Solidity: event SendWarpMessage(address indexed sender, bytes32 indexed messageID, bytes message) +func (_IWarpMessenger *IWarpMessengerFilterer) ParseSendWarpMessage(log types.Log) (*IWarpMessengerSendWarpMessage, error) { + event := new(IWarpMessengerSendWarpMessage) + if err := _IWarpMessenger.contract.UnpackLog(event, "SendWarpMessage", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index dbbc4ea61f..e7ea93991b 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -29,6 +29,7 @@ import ( "github.com/ava-labs/libevm/log" "github.com/stretchr/testify/require" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/cmd/simulator/key" "github.com/ava-labs/subnet-evm/cmd/simulator/load" "github.com/ava-labs/subnet-evm/cmd/simulator/metrics" @@ -41,6 +42,7 @@ import ( avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" ethereum "github.com/ava-labs/libevm" + warpbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" warpBackend "github.com/ava-labs/subnet-evm/warp" ginkgo "github.com/onsi/ginkgo/v2" ) @@ -289,8 +291,37 @@ func (w *warpTest) sendMessageFromSendingSubnet() { tc := e2e.NewTestContext() ctx := tc.DefaultContext() require := require.New(ginkgo.GinkgoT()) - client := w.sendingSubnetClients[0] + + blockHash, blockNumber := w.sendWarpMessageTx(ctx, client) + w.blockID = ids.ID(blockHash) + + w.addressedCallUnsignedMessage = w.verifyAndExtractWarpMessage(ctx, client, blockHash, blockNumber) + log.Info("Parsed unsignedWarpMsg", + "unsignedWarpMessageID", w.addressedCallUnsignedMessage.ID(), + "unsignedWarpMessage", w.addressedCallUnsignedMessage, + ) + + // Loop over each client on chain A to ensure they all have time to accept the block. + // Note: if we did not confirm this here, the next stage could be racy since it assumes every node + // has accepted the block. + for i, client := range w.sendingSubnetClients { + // Loop until each node has advanced to >= the height of the block that emitted the warp log + for { + block, err := client.BlockByNumber(ctx, nil) + require.NoError(err) + if block.NumberU64() >= blockNumber { + log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) + break + } + } + } +} + +// sendWarpMessageTx sends a warp message and returns the block hash and number +func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Client) (common.Hash, uint64) { + require := require.New(ginkgo.GinkgoT()) + log.Info("Subscribing to new heads") newHeads := make(chan *types.Header, 10) sub, err := client.SubscribeNewHead(ctx, newHeads) @@ -302,6 +333,7 @@ func (w *warpTest) sendMessageFromSendingSubnet() { packedInput, err := warp.PackSendWarpMessage(testPayload) require.NoError(err) + tx := types.NewTx(&types.DynamicFeeTx{ ChainID: w.sendingSubnetChainID, Nonce: startingNonce, @@ -312,22 +344,35 @@ func (w *warpTest) sendMessageFromSendingSubnet() { Value: common.Big0, Data: packedInput, }) + signedTx, err := types.SignTx(tx, w.sendingSubnetSigner, w.sendingSubnetFundedKey) require.NoError(err) + log.Info("Sending sendWarpMessage transaction", "txHash", signedTx.Hash()) require.NoError(client.SendTransaction(ctx, signedTx)) - log.Info("Waiting for new block confirmation") <-newHeads receiptCtx, cancel := context.WithTimeout(ctx, 10*time.Second) defer cancel() + blockHash, blockNumber := w.getBlockHashAndNumberFromTxReceipt(receiptCtx, client, signedTx) + log.Info("Warp message included in block", "blockHash", blockHash, "blockNumber", blockNumber) - log.Info("Constructing warp block hash unsigned message", "blockHash", blockHash) - w.blockID = ids.ID(blockHash) // Set blockID to construct a warp message containing a block hash payload later - require.NoError(err) + return blockHash, blockNumber +} + +// verifyAndExtractWarpMessage verifies the SendWarpMessage event using both raw client +// and bindings filtering, ensuring they return consistent results. +func (w *warpTest) verifyAndExtractWarpMessage( + ctx context.Context, + client ethclient.Client, + blockHash common.Hash, + blockNumber uint64, +) *avalancheWarp.UnsignedMessage { + require := require.New(ginkgo.GinkgoT()) - log.Info("Fetching relevant warp logs from the newly produced block") + // Method 1: Raw client FilterLogs + log.Info("Filtering SendWarpMessage events using raw client") logs, err := client.FilterLogs(ctx, ethereum.FilterQuery{ BlockHash: &blockHash, Addresses: []common.Address{warp.Module.Address}, @@ -335,31 +380,41 @@ func (w *warpTest) sendMessageFromSendingSubnet() { require.NoError(err) require.Len(logs, 1) - // Check for relevant warp log from subscription and ensure that it matches - // the log extracted from the last block. - txLog := logs[0] - log.Info("Parsing logData as unsigned warp message") - unsignedMsg, err := warp.UnpackSendWarpEventDataToMessage(txLog.Data) + unsignedMsgFromClient, err := warp.UnpackSendWarpEventDataToMessage(logs[0].Data) require.NoError(err) - // Set local variables for the duration of the test - w.addressedCallUnsignedMessage = unsignedMsg - log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", w.addressedCallUnsignedMessage.ID(), "unsignedWarpMessage", w.addressedCallUnsignedMessage) + // Method 2: Typed bindings FilterSendWarpMessage + log.Info("Filtering SendWarpMessage events using bindings") + warpFilterer, err := warpbindings.NewIWarpMessengerFilterer(warp.Module.Address, client) + require.NoError(err) - // Loop over each client on chain A to ensure they all have time to accept the block. - // Note: if we did not confirm this here, the next stage could be racy since it assumes every node - // has accepted the block. - for i, client := range w.sendingSubnetClients { - // Loop until each node has advanced to >= the height of the block that emitted the warp log - for { - block, err := client.BlockByNumber(ctx, nil) - require.NoError(err) - if block.NumberU64() >= blockNumber { - log.Info("client accepted the block containing SendWarpMessage", "client", i, "height", block.NumberU64()) - break - } - } - } + iter, err := warpFilterer.FilterSendWarpMessage(&bind.FilterOpts{ + Start: blockNumber, + End: &blockNumber, + Context: ctx, + }, []common.Address{w.sendingSubnetFundedAddress}, nil) + require.NoError(err) + defer iter.Close() + + require.True(iter.Next(), "expected SendWarpMessage event") + event := iter.Event + require.Equal(w.sendingSubnetFundedAddress, event.Sender) + require.False(iter.Next(), "expected exactly one SendWarpMessage event") + require.NoError(iter.Error()) + + log.Info("Found SendWarpMessage event", + "sender", event.Sender.Hex(), + "messageID", common.BytesToHash(event.MessageID[:]).Hex(), + ) + + unsignedMsgFromBindings, err := warp.UnpackSendWarpEventDataToMessage(event.Message) + require.NoError(err) + + // Verify both methods return the same message + require.Equal(unsignedMsgFromClient.Bytes(), unsignedMsgFromBindings.Bytes(), + "client and bindings filtering should return the same unsigned message") + + return unsignedMsgFromBindings } func (w *warpTest) aggregateSignaturesViaAPI() { @@ -564,23 +619,17 @@ func (w *warpTest) verifyWarpMessageAndBlockchainID() { "source chain ID mismatch in unsigned message", ) - log.Info("Calling getBlockchainID on warp precompile") - packedInput, err := warp.PackGetBlockchainID() + log.Info("Calling getBlockchainID on warp precompile using bindings") + warpCaller, err := warpbindings.NewIWarpMessengerCaller(warp.Module.Address, client) require.NoError(err) - result, err := client.CallContract(ctx, ethereum.CallMsg{ - To: &warp.Module.Address, - Data: packedInput, - }, nil) + returnedBlockchainID, err := warpCaller.GetBlockchainID(&bind.CallOpts{Context: ctx}) require.NoError(err) - require.Len(result, 32, "getBlockchainID should return 32 bytes") - returnedBlockchainID := ids.ID(common.BytesToHash(result)) - - log.Info("getBlockchainID returned", "blockchainID", returnedBlockchainID) + log.Info("getBlockchainID returned", "blockchainID", ids.ID(returnedBlockchainID)) require.Equal( w.sendingSubnet.BlockchainID, - returnedBlockchainID, + ids.ID(returnedBlockchainID), "getBlockchainID returned unexpected value", ) From f9deda0749e5f4772b09990105166aa9458fabb5 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:58:37 -0500 Subject: [PATCH 37/73] chore: revert util.ts deletion --- contracts/contracts/util.ts | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 contracts/contracts/util.ts diff --git a/contracts/contracts/util.ts b/contracts/contracts/util.ts new file mode 100644 index 0000000000..5d272d7d98 --- /dev/null +++ b/contracts/contracts/util.ts @@ -0,0 +1,42 @@ +/* + * + * The `test` function is a wrapper around Mocha's `it` function. It provides a normalized framework for running the + * majority of your test assertions inside of a smart-contract, using `DS-Test`. + * The API can be used as follows (all of the examples are equivalent): + * ```ts + * test("", "") + * test("", [""]) + * test("", { method: "", overrides: {}, shouldFail: false, debug: false }) + * test("", [{ method: "", overrides: {}, shouldFail: false, debug: false }]) + * test("", [{ method: "", shouldFail: false, debug: false }], {}) + * ``` + * Many contract functions can be called as a part of the same test: + * ```ts + * test("", ["", "", ""]) + * ``` + * Individual test functions can describe their own overrides with the `overrides` property. + * If an object is passed in as the third argument to `test`, it will be used as the default overrides for all test + * functions. + * The following are equivalent: + * ```ts + * test("", [{ method: "", overrides: { from: "0x123" } }]) + * test("", [{ method: "" }], { from: "0x123" }) + * ``` + * In the above cases, the `from` override must be a signer. + * The `shouldFail` property can be used to indicate that the test function should fail. This should be used sparingly + * as it is not possible to match on the failure reason. + * Furthermore, the `debug` property can be used to print any thrown errors when attempting to + * send a transaction or while waiting for the transaction to be confirmed (the transaction is the smart contract call). + * `debug` will also cause any parseable event logs to be printed that start with the `log_` prefix. + * `DSTest` contracts have several options for emitting `log_` events. + * + */ + +// Below are the types that help define all the different ways to call `test` + +export const Roles = { + None: 0, + Enabled: 1, + Admin: 2, + Manager: 3, +} \ No newline at end of file From 15729af8be83d448dd0038294a8be645441ef19f Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:59:30 -0500 Subject: [PATCH 38/73] chore: move util.ts --- contracts/{contracts => test}/util.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename contracts/{contracts => test}/util.ts (100%) diff --git a/contracts/contracts/util.ts b/contracts/test/util.ts similarity index 100% rename from contracts/contracts/util.ts rename to contracts/test/util.ts From e5631aad3f0e3d3be13ae97a4eb8baaebf6c89b4 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 13:59:49 -0500 Subject: [PATCH 39/73] chore: rename util -> utils --- contracts/test/{util.ts => utils.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename contracts/test/{util.ts => utils.ts} (100%) diff --git a/contracts/test/util.ts b/contracts/test/utils.ts similarity index 100% rename from contracts/test/util.ts rename to contracts/test/utils.ts From 36eca4a095202af0baba349194b6ecebe2cc440b Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:03:06 -0500 Subject: [PATCH 40/73] fix: export only roles --- contracts/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/index.ts b/contracts/index.ts index fb69b71c8a..9c7bf2d23c 100644 --- a/contracts/index.ts +++ b/contracts/index.ts @@ -1 +1 @@ -export { test } from './test/utils'; +export { Roles } from './test/utils'; From 282f862214410432c37d37ff083c23645af35704 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:18:17 -0500 Subject: [PATCH 41/73] fix: verifyAndExtractWarpMessage() --- tests/warp/warp_test.go | 86 +++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 30 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index e7ea93991b..1b38ae3757 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -37,12 +37,12 @@ import ( "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/precompile/contracts/warp" + warpbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" "github.com/ava-labs/subnet-evm/tests" "github.com/ava-labs/subnet-evm/tests/utils" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" ethereum "github.com/ava-labs/libevm" - warpbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" warpBackend "github.com/ava-labs/subnet-evm/warp" ginkgo "github.com/onsi/ginkgo/v2" ) @@ -362,7 +362,21 @@ func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Clien } // verifyAndExtractWarpMessage verifies the SendWarpMessage event using both raw client -// and bindings filtering, ensuring they return consistent results. +// filtering and topic-filtered querying, then extracts the unsigned message. +// +// We use topic-filtered FilterLogs queries instead of the generated binding's +// FilterSendWarpMessage iterator because the binding's UnpackLog, +// `func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log) error` +// fails to decode the warp precompile's event data. The precompile uses WarpABI.PackEvent +// which produces valid ABI-encoded data, but the generated binding's decoder seemingly +// expects a different format, causing offset calculation errors like this: +// +// > abi: cannot marshal in to go slice: offset +// > 36566719137455486913336721525167888666359637725852346248021916651272 would go +// > over slice boundary +// +// So instead we use raw FilterLogs with topic filters to extract the event data. +// TODO(JonathanOppenheimer): is there a better way to do this? a workaround? func (w *warpTest) verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, @@ -371,50 +385,62 @@ func (w *warpTest) verifyAndExtractWarpMessage( ) *avalancheWarp.UnsignedMessage { require := require.New(ginkgo.GinkgoT()) - // Method 1: Raw client FilterLogs + // Method 1: Raw client FilterLogs (by address only) log.Info("Filtering SendWarpMessage events using raw client") - logs, err := client.FilterLogs(ctx, ethereum.FilterQuery{ + clientLogs, err := client.FilterLogs(ctx, ethereum.FilterQuery{ BlockHash: &blockHash, Addresses: []common.Address{warp.Module.Address}, }) require.NoError(err) - require.Len(logs, 1) + require.Len(clientLogs, 1) - unsignedMsgFromClient, err := warp.UnpackSendWarpEventDataToMessage(logs[0].Data) + clientLog := clientLogs[0] + unsignedMsgFromClient, err := warp.UnpackSendWarpEventDataToMessage(clientLog.Data) require.NoError(err) - // Method 2: Typed bindings FilterSendWarpMessage - log.Info("Filtering SendWarpMessage events using bindings") - warpFilterer, err := warpbindings.NewIWarpMessengerFilterer(warp.Module.Address, client) + // Method 2: Filter with indexed topic filters (event ID + sender) + // This replicates what the binding's FilterSendWarpMessage does internally, + // but without using the broken UnpackLog decoder. + log.Info("Filtering SendWarpMessage events using topic filters") + eventID := warp.WarpABI.Events["SendWarpMessage"].ID + senderTopic := common.BytesToHash(w.sendingSubnetFundedAddress.Bytes()) + + topicFilteredLogs, err := client.FilterLogs(ctx, ethereum.FilterQuery{ + FromBlock: big.NewInt(int64(blockNumber)), + ToBlock: big.NewInt(int64(blockNumber)), + Addresses: []common.Address{warp.Module.Address}, + Topics: [][]common.Hash{ + {eventID}, // Topic 0: Event signature + {senderTopic}, // Topic 1: Indexed sender + nil, // Topic 2: Any messageID + }, + }) require.NoError(err) + require.Len(topicFilteredLogs, 1) - iter, err := warpFilterer.FilterSendWarpMessage(&bind.FilterOpts{ - Start: blockNumber, - End: &blockNumber, - Context: ctx, - }, []common.Address{w.sendingSubnetFundedAddress}, nil) + topicLog := topicFilteredLogs[0] + unsignedMsgFromTopicFilter, err := warp.UnpackSendWarpEventDataToMessage(topicLog.Data) require.NoError(err) - defer iter.Close() - require.True(iter.Next(), "expected SendWarpMessage event") - event := iter.Event - require.Equal(w.sendingSubnetFundedAddress, event.Sender) - require.False(iter.Next(), "expected exactly one SendWarpMessage event") - require.NoError(iter.Error()) + // Verify both methods return the same event + require.Equal(clientLog.TxHash, topicLog.TxHash, "transaction hash mismatch") + require.Equal(clientLog.Data, topicLog.Data, "log data mismatch") - log.Info("Found SendWarpMessage event", - "sender", event.Sender.Hex(), - "messageID", common.BytesToHash(event.MessageID[:]).Hex(), - ) + // Verify both produce the same unsigned message + require.Equal(unsignedMsgFromClient.Bytes(), unsignedMsgFromTopicFilter.Bytes(), + "raw and topic-filtered queries should return the same unsigned message") - unsignedMsgFromBindings, err := warp.UnpackSendWarpEventDataToMessage(event.Message) - require.NoError(err) + // Verify event topics + require.Len(clientLog.Topics, 3, "SendWarpMessage should have 3 topics") + require.Equal(eventID, clientLog.Topics[0], "event ID mismatch") + require.Equal(senderTopic, clientLog.Topics[1], "sender topic mismatch") - // Verify both methods return the same message - require.Equal(unsignedMsgFromClient.Bytes(), unsignedMsgFromBindings.Bytes(), - "client and bindings filtering should return the same unsigned message") + log.Info("Found SendWarpMessage event via both methods", + "sender", w.sendingSubnetFundedAddress.Hex(), + "messageID", clientLog.Topics[2].Hex(), + ) - return unsignedMsgFromBindings + return unsignedMsgFromTopicFilter } func (w *warpTest) aggregateSignaturesViaAPI() { From 8725814ab67bbb37d21b5eeb12f2cfaa4264f1b0 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:21:58 -0500 Subject: [PATCH 42/73] chore: lint --- tests/warp/warp_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 1b38ae3757..18871046ff 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -37,12 +37,12 @@ import ( "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/precompile/contracts/warp" - warpbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" "github.com/ava-labs/subnet-evm/tests" "github.com/ava-labs/subnet-evm/tests/utils" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" ethereum "github.com/ava-labs/libevm" + warpbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" warpBackend "github.com/ava-labs/subnet-evm/warp" ginkgo "github.com/onsi/ginkgo/v2" ) From 8702753f395c989454e9c02c72d76db8e52fe324 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:28:55 -0500 Subject: [PATCH 43/73] Update precompile/contracts/testutils/simulated_helpers.go Co-authored-by: Ceyhun Onur Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- precompile/contracts/testutils/simulated_helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index d080029cee..61fa3baaf1 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -52,7 +52,7 @@ func NewBackendWithPrecompileAndOptions(t *testing.T, precompileCfg precompileco genesisAlloc[addr] = types.Account{Balance: big.NewInt(1000000000000000000)} } - allOpts := append([]func(*node.Config, *ethconfig.Config){sim.WithChainConfig(&chainCfg)}, opts...) + allOpts := append(opts, sim.WithChainConfig(&chainCfg)) return sim.NewBackend(genesisAlloc, allOpts...) } From 885905324f39cb9bd8f235207af2d05fbd41952b Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:29:55 -0500 Subject: [PATCH 44/73] fix: don't export sendSimpleTx --- precompile/contracts/rewardmanager/simulated_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 4f61eab15a..6d39577416 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -55,10 +55,10 @@ func deployRewardManagerTest(t *testing.T, b *sim.Backend, auth *bind.TransactOp return addr, contract } -// SendSimpleTx sends a simple ETH transfer transaction +// sendSimpleTx sends a simple ETH transfer transaction // See ethclient/simulated/backend_test.go newTx() for the source of this code // TODO(jonathanoppenheimer): after libevmifiying the geth code, investigate whether we can use the same code for both -func SendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Transaction { +func sendSimpleTx(t *testing.T, b *sim.Backend, key *ecdsa.PrivateKey) *types.Transaction { t.Helper() client := b.Client() addr := crypto.PubkeyToAddress(key.PublicKey) @@ -220,7 +220,7 @@ func TestRewardManager(t *testing.T) { initialBlackholeBalance, err := client.BalanceAt(t.Context(), constants.BlackholeAddr, nil) require.NoError(t, err) - tx := SendSimpleTx(t, backend, adminKey) + tx := sendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) newBlackholeBalance, err := client.BalanceAt(t.Context(), constants.BlackholeAddr, nil) @@ -253,7 +253,7 @@ func TestRewardManager(t *testing.T) { require.Equal(t, rewardRecipientAddr, currentAddr) // The fees from this transaction should go to the reward address - tx = SendSimpleTx(t, backend, adminKey) + tx = sendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) newRecipientBalance, err := client.BalanceAt(t.Context(), rewardRecipientAddr, nil) @@ -283,7 +283,7 @@ func TestRewardManager(t *testing.T) { require.NoError(t, err) // The fees from this transaction should go to the coinbase address - tx := SendSimpleTx(t, backend, adminKey) + tx := sendSimpleTx(t, backend, adminKey) testutils.WaitReceiptSuccessful(t, backend, tx) newCoinbaseBalance, err := client.BalanceAt(t.Context(), coinbaseAddr, nil) From 9177c3a57af770d4069159efabb88e6065170b1c Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:33:08 -0500 Subject: [PATCH 45/73] chore: consolidate NewBackendWithPrecompile --- .../allowlisttest/test_allowlist_events.go | 2 +- .../contracts/deployerallowlist/simulated_test.go | 2 +- precompile/contracts/feemanager/simulated_test.go | 4 ++-- .../contracts/nativeminter/simulated_test.go | 4 ++-- .../contracts/rewardmanager/simulated_test.go | 4 ++-- .../contracts/testutils/simulated_helpers.go | 14 ++++++-------- precompile/contracts/txallowlist/simulated_test.go | 2 +- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/precompile/allowlist/allowlisttest/test_allowlist_events.go b/precompile/allowlist/allowlisttest/test_allowlist_events.go index 178821bc4b..a92fd75c7c 100644 --- a/precompile/allowlist/allowlisttest/test_allowlist_events.go +++ b/precompile/allowlist/allowlisttest/test_allowlist_events.go @@ -121,7 +121,7 @@ func RunAllowListEventTests( t.Run(tc.name, func(t *testing.T) { require := require.New(t) - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, fundedAddrs...) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, fundedAddrs) defer backend.Close() allowList, err := allowlistbindings.NewIAllowList(contractAddress, backend.Client()) diff --git a/precompile/contracts/deployerallowlist/simulated_test.go b/precompile/contracts/deployerallowlist/simulated_test.go index b4ab81a8bb..f728b025d0 100644 --- a/precompile/contracts/deployerallowlist/simulated_test.go +++ b/precompile/contracts/deployerallowlist/simulated_test.go @@ -185,7 +185,7 @@ func TestDeployerAllowList(t *testing.T) { precompileCfg := deployerallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() allowList, err := allowlistbindings.NewIAllowList(deployerallowlist.ContractAddress, backend.Client()) diff --git a/precompile/contracts/feemanager/simulated_test.go b/precompile/contracts/feemanager/simulated_test.go index a18ad677d0..e1b04a952d 100644 --- a/precompile/contracts/feemanager/simulated_test.go +++ b/precompile/contracts/feemanager/simulated_test.go @@ -236,7 +236,7 @@ func TestFeeManager(t *testing.T) { precompileCfg := feemanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, &genesisFeeConfig) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() feeManager, err := feemanagerbindings.NewIFeeManager(feemanager.ContractAddress, backend.Client()) @@ -252,7 +252,7 @@ func TestIFeeManager_Events(t *testing.T) { admin := testutils.NewAuth(t, adminKey, chainID) precompileCfg := feemanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, &genesisFeeConfig) - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() feeManager, err := feemanagerbindings.NewIFeeManager(feemanager.ContractAddress, backend.Client()) diff --git a/precompile/contracts/nativeminter/simulated_test.go b/precompile/contracts/nativeminter/simulated_test.go index cfb00696f5..16cc772ba7 100644 --- a/precompile/contracts/nativeminter/simulated_test.go +++ b/precompile/contracts/nativeminter/simulated_test.go @@ -146,7 +146,7 @@ func TestNativeMinter(t *testing.T) { precompileCfg := nativeminter.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() nativeMinter, err := nativeminterbindings.NewINativeMinter(nativeminter.ContractAddress, backend.Client()) @@ -164,7 +164,7 @@ func TestINativeMinter_Events(t *testing.T) { testAddress := crypto.PubkeyToAddress(testKey.PublicKey) precompileCfg := nativeminter.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil) - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() nativeMinter, err := nativeminterbindings.NewINativeMinter(nativeminter.ContractAddress, backend.Client()) diff --git a/precompile/contracts/rewardmanager/simulated_test.go b/precompile/contracts/rewardmanager/simulated_test.go index 6d39577416..5bb7559dd5 100644 --- a/precompile/contracts/rewardmanager/simulated_test.go +++ b/precompile/contracts/rewardmanager/simulated_test.go @@ -298,7 +298,7 @@ func TestRewardManager(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { cfg := rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, tc.initialRewardConfig) - backend := testutils.NewBackendWithPrecompileAndOptions(t, cfg, []common.Address{adminAddress, unprivilegedAddress}, tc.backendOpts...) + backend := testutils.NewBackendWithPrecompile(t, cfg, []common.Address{adminAddress, unprivilegedAddress}, tc.backendOpts...) defer backend.Close() rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) @@ -392,7 +392,7 @@ func TestIRewardManager_Events(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := testutils.NewBackendWithPrecompile(t, rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, rewardmanager.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil, nil), []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() rewardManager, err := rewardmanagerbindings.NewIRewardManager(rewardmanager.ContractAddress, backend.Client()) diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 61fa3baaf1..67bad53e5d 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -31,16 +31,14 @@ func NewAuth(t *testing.T, key *ecdsa.PrivateKey, chainID *big.Int) *bind.Transa } // NewBackendWithPrecompile creates a simulated backend with the given precompile enabled -// at genesis and funds the specified addresses with 1 ETH each. -func NewBackendWithPrecompile(t *testing.T, precompileCfg precompileconfig.Config, fundedAddrs ...common.Address) *sim.Backend { - t.Helper() - return NewBackendWithPrecompileAndOptions(t, precompileCfg, fundedAddrs) -} - -// NewBackendWithPrecompileAndOptions creates a simulated backend with the given precompile enabled // at genesis and funds the specified addresses with 1 ETH each. Additional options can be passed // to configure the backend. -func NewBackendWithPrecompileAndOptions(t *testing.T, precompileCfg precompileconfig.Config, fundedAddrs []common.Address, opts ...func(*node.Config, *ethconfig.Config)) *sim.Backend { +func NewBackendWithPrecompile( + t *testing.T, + precompileCfg precompileconfig.Config, + fundedAddrs []common.Address, + opts ...func(*node.Config, *ethconfig.Config), +) *sim.Backend { t.Helper() chainCfg := params.Copy(params.TestChainConfig) params.GetExtra(&chainCfg).GenesisPrecompiles = extras.Precompiles{ diff --git a/precompile/contracts/txallowlist/simulated_test.go b/precompile/contracts/txallowlist/simulated_test.go index 20a6a98028..f0033e4b6d 100644 --- a/precompile/contracts/txallowlist/simulated_test.go +++ b/precompile/contracts/txallowlist/simulated_test.go @@ -271,7 +271,7 @@ func TestTxAllowList(t *testing.T) { precompileCfg := txallowlist.NewConfig(utils.NewUint64(0), []common.Address{adminAddress}, nil, nil) for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - backend := testutils.NewBackendWithPrecompile(t, precompileCfg, adminAddress, unprivilegedAddress) + backend := testutils.NewBackendWithPrecompile(t, precompileCfg, []common.Address{adminAddress, unprivilegedAddress}) defer backend.Close() allowList, err := allowlistbindings.NewIAllowList(txallowlist.ContractAddress, backend.Client()) From b2fbe9e7364875bffb71348935ce8e3a3666b533 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:35:03 -0500 Subject: [PATCH 46/73] chore: lint --- precompile/contracts/testutils/simulated_helpers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/precompile/contracts/testutils/simulated_helpers.go b/precompile/contracts/testutils/simulated_helpers.go index 67bad53e5d..da69e4936b 100644 --- a/precompile/contracts/testutils/simulated_helpers.go +++ b/precompile/contracts/testutils/simulated_helpers.go @@ -50,8 +50,8 @@ func NewBackendWithPrecompile( genesisAlloc[addr] = types.Account{Balance: big.NewInt(1000000000000000000)} } - allOpts := append(opts, sim.WithChainConfig(&chainCfg)) - return sim.NewBackend(genesisAlloc, allOpts...) + opts = append(opts, sim.WithChainConfig(&chainCfg)) + return sim.NewBackend(genesisAlloc, opts...) } // WaitReceipt commits the simulated backend and waits for the transaction receipt. From 64c71f85053f9df5007d8314279f725575eaf617 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:44:33 -0500 Subject: [PATCH 47/73] chore: delete warp.json --- tests/precompile/genesis/warp.json | 45 ------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 tests/precompile/genesis/warp.json diff --git a/tests/precompile/genesis/warp.json b/tests/precompile/genesis/warp.json deleted file mode 100644 index e4c17d05f0..0000000000 --- a/tests/precompile/genesis/warp.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "config": { - "chainId": 99999, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "muirGlacierBlock": 0, - "feeConfig": { - "gasLimit": 20000000, - "minBaseFee": 1000000000, - "targetGas": 100000000, - "baseFeeChangeDenominator": 48, - "minBlockGasCost": 0, - "maxBlockGasCost": 10000000, - "targetBlockRate": 2, - "blockGasCostStep": 500000 - }, - "warpConfig": { - "blockTimestamp": 1607144400 - } - }, - "alloc": { - "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { - "balance": "0x52B7D2DCC80CD2E4000000" - }, - "0x0Fa8EA536Be85F32724D57A37758761B86416123": { - "balance": "0x52B7D2DCC80CD2E4000000" - } - }, - "nonce": "0x0", - "timestamp": "0x5FCB13D0", - "extraData": "0x00", - "gasLimit": "0x1312D00", - "difficulty": "0x0", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", - "number": "0x0", - "gasUsed": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} From 97e182c00c8f517bbf50c9700a87160e6a9d9380 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Fri, 5 Dec 2025 14:54:14 -0500 Subject: [PATCH 48/73] fix: revert delete warp.json --- tests/precompile/genesis/warp.json | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/precompile/genesis/warp.json diff --git a/tests/precompile/genesis/warp.json b/tests/precompile/genesis/warp.json new file mode 100644 index 0000000000..ab59d8a10e --- /dev/null +++ b/tests/precompile/genesis/warp.json @@ -0,0 +1,45 @@ +{ + "config": { + "chainId": 99999, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "feeConfig": { + "gasLimit": 20000000, + "minBaseFee": 1000000000, + "targetGas": 100000000, + "baseFeeChangeDenominator": 48, + "minBlockGasCost": 0, + "maxBlockGasCost": 10000000, + "targetBlockRate": 2, + "blockGasCostStep": 500000 + }, + "warpConfig": { + "blockTimestamp": 1607144400 + } + }, + "alloc": { + "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { + "balance": "0x52B7D2DCC80CD2E4000000" + }, + "0x0Fa8EA536Be85F32724D57A37758761B86416123": { + "balance": "0x52B7D2DCC80CD2E4000000" + } + }, + "nonce": "0x0", + "timestamp": "0x5FCB13D0", + "extraData": "0x00", + "gasLimit": "0x1312D00", + "difficulty": "0x0", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "number": "0x0", + "gasUsed": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" + } \ No newline at end of file From 473405a02789489f4278ef3779e0450b0893320f Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 13:56:21 -0500 Subject: [PATCH 49/73] test: move interfaces to top level --- precompile/allowlist/IAllowList.sol | 26 ++++++ .../allowlisttest/bindings/AllowList.sol | 89 ------------------- .../allowlisttest/bindings/AllowListTest.sol | 57 ++++++++++-- .../allowlisttest/bindings/IAllowList.sol | 21 ----- .../allowlisttest/bindings/compile.go | 2 +- .../bindings/gen_allowlisttest_binding.go | 56 +++++++++++- .../contracts/feemanager/IFeeManager.sol | 54 +++++++++++ .../bindings/FeeManagerTest.sol | 2 +- .../feemanagertest/bindings/IFeeManager.sol | 47 ---------- .../bindings/gen_feemanagertest_binding.go | 2 +- .../contracts/nativeminter/INativeMinter.sol | 13 +++ .../bindings/INativeMinter.sol | 9 -- .../bindings/NativeMinterTest.sol | 2 +- .../bindings/gen_nativemintertest_binding.go | 2 +- .../bindings => }/IRewardManager.sol | 2 +- .../bindings/RewardManagerTest.sol | 2 +- .../rewardmanagertest/bindings/compile.go | 2 +- .../bindings/gen_rewardmanagertest_binding.go | 2 +- 18 files changed, 208 insertions(+), 182 deletions(-) create mode 100644 precompile/allowlist/IAllowList.sol delete mode 100644 precompile/allowlist/allowlisttest/bindings/AllowList.sol delete mode 100644 precompile/allowlist/allowlisttest/bindings/IAllowList.sol create mode 100644 precompile/contracts/feemanager/IFeeManager.sol delete mode 100644 precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol create mode 100644 precompile/contracts/nativeminter/INativeMinter.sol delete mode 100644 precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol rename precompile/contracts/rewardmanager/{rewardmanagertest/bindings => }/IRewardManager.sol (94%) diff --git a/precompile/allowlist/IAllowList.sol b/precompile/allowlist/IAllowList.sol new file mode 100644 index 0000000000..2e031d0bf1 --- /dev/null +++ b/precompile/allowlist/IAllowList.sol @@ -0,0 +1,26 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +interface IAllowList { + event RoleSet( + uint256 indexed role, + address indexed account, + address indexed sender, + uint256 oldRole + ); + + // Set [addr] to have the admin role over the precompile contract. + function setAdmin(address addr) external; + + // Set [addr] to be enabled on the precompile contract. + function setEnabled(address addr) external; + + // Set [addr] to have the manager role over the precompile contract. + function setManager(address addr) external; + + // Set [addr] to have no role for the precompile contract. + function setNone(address addr) external; + + // Read the status of [addr]. + function readAllowList(address addr) external view returns (uint256 role); +} diff --git a/precompile/allowlist/allowlisttest/bindings/AllowList.sol b/precompile/allowlist/allowlisttest/bindings/AllowList.sol deleted file mode 100644 index f3eb1c84c3..0000000000 --- a/precompile/allowlist/allowlisttest/bindings/AllowList.sol +++ /dev/null @@ -1,89 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -import "./IAllowList.sol"; - -// AllowList is a base contract to use AllowList precompile capabilities. -contract AllowList { - // Precompiled Allow List Contract Address - IAllowList private allowList; - - uint256 constant STATUS_NONE = 0; - uint256 constant STATUS_ENABLED = 1; - uint256 constant STATUS_ADMIN = 2; - uint256 constant STATUS_MANAGER = 3; - - enum Role { - None, - Enabled, - Admin, - Manager - } - - constructor(address precompileAddr) { - allowList = IAllowList(precompileAddr); - } - - modifier onlyEnabled() { - require(isEnabled(msg.sender), "not enabled"); - _; - } - - modifier canModifyAllowList() { - require( - isAdmin(msg.sender) || isManager(msg.sender), - "cannot modify allow list" - ); - _; - } - - function isAdmin(address addr) public view returns (bool) { - uint256 result = allowList.readAllowList(addr); - return result == STATUS_ADMIN; - } - - function isManager(address addr) public view returns (bool) { - uint256 result = allowList.readAllowList(addr); - return result == STATUS_MANAGER; - } - - function isEnabled(address addr) public view returns (bool) { - uint256 result = allowList.readAllowList(addr); - // if address is ENABLED or ADMIN or MANAGER it can deploy - // in other words, if it's not NONE it can deploy. - return result != STATUS_NONE; - } - - function setAdmin(address addr) public virtual canModifyAllowList { - _setAdmin(addr); - } - - function _setAdmin(address addr) private { - allowList.setAdmin(addr); - } - - function setManager(address addr) public virtual canModifyAllowList { - _setManager(addr); - } - - function _setManager(address addr) private { - allowList.setManager(addr); - } - - function setEnabled(address addr) public virtual canModifyAllowList { - _setEnabled(addr); - } - - function _setEnabled(address addr) private { - allowList.setEnabled(addr); - } - - function revoke(address addr) public virtual canModifyAllowList { - _revoke(addr); - } - - function _revoke(address addr) private { - require(msg.sender != addr, "cannot revoke own role"); - allowList.setNone(addr); - } -} diff --git a/precompile/allowlist/allowlisttest/bindings/AllowListTest.sol b/precompile/allowlist/allowlisttest/bindings/AllowListTest.sol index c872192ffd..0b88250398 100644 --- a/precompile/allowlist/allowlisttest/bindings/AllowListTest.sol +++ b/precompile/allowlist/allowlisttest/bindings/AllowListTest.sol @@ -1,13 +1,60 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "./IAllowList.sol"; -import "./AllowList.sol"; +import "precompile/allowlist/IAllowList.sol"; -contract AllowListTest is AllowList { - // Precompiled Allow List Contract Address - constructor(address precompileAddr) AllowList(precompileAddr) {} +contract AllowListTest { + IAllowList private allowList; + uint256 constant STATUS_NONE = 0; + uint256 constant STATUS_ENABLED = 1; + uint256 constant STATUS_ADMIN = 2; + uint256 constant STATUS_MANAGER = 3; + + constructor(address precompileAddr) { + allowList = IAllowList(precompileAddr); + } + + function setAdmin(address addr) external { + allowList.setAdmin(addr); + } + + function setEnabled(address addr) external { + allowList.setEnabled(addr); + } + + function setManager(address addr) external { + allowList.setManager(addr); + } + + function setNone(address addr) external { + allowList.setNone(addr); + } + + function readAllowList(address addr) external view returns (uint256) { + return allowList.readAllowList(addr); + } + + // Helper functions used by tests + function isAdmin(address addr) public view returns (bool) { + return allowList.readAllowList(addr) == STATUS_ADMIN; + } + + function isManager(address addr) public view returns (bool) { + return allowList.readAllowList(addr) == STATUS_MANAGER; + } + + function isEnabled(address addr) public view returns (bool) { + // Returns true if address has any role (not NONE) + return allowList.readAllowList(addr) != STATUS_NONE; + } + + function revoke(address addr) public { + require(msg.sender != addr, "cannot revoke own role"); + allowList.setNone(addr); + } + + // Used by deployerallowlist tests to verify contract deployment permissions function deployContract() public { new Example(); } diff --git a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol b/precompile/allowlist/allowlisttest/bindings/IAllowList.sol deleted file mode 100644 index 8b525b12e1..0000000000 --- a/precompile/allowlist/allowlisttest/bindings/IAllowList.sol +++ /dev/null @@ -1,21 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; - -interface IAllowList { - event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole); - - // Set [addr] to have the admin role over the precompile contract. - function setAdmin(address addr) external; - - // Set [addr] to be enabled on the precompile contract. - function setEnabled(address addr) external; - - // Set [addr] to have the manager role over the precompile contract. - function setManager(address addr) external; - - // Set [addr] to have no role for the precompile contract. - function setNone(address addr) external; - - // Read the status of [addr]. - function readAllowList(address addr) external view returns (uint256 role); -} diff --git a/precompile/allowlist/allowlisttest/bindings/compile.go b/precompile/allowlist/allowlisttest/bindings/compile.go index 3df2a2717e..5f61ec354a 100644 --- a/precompile/allowlist/allowlisttest/bindings/compile.go +++ b/precompile/allowlist/allowlisttest/bindings/compile.go @@ -4,7 +4,7 @@ package bindings // Step 1: Compile Solidity contracts to generate ABI and bin files -//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path . precompile/=../../ --evm-version cancun AllowListTest.sol +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path . precompile/=../../../ --evm-version cancun AllowListTest.sol // Step 2: Generate Go bindings from the compiled artifacts //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IAllowList --abi artifacts/IAllowList.abi --bin artifacts/IAllowList.bin --out gen_allowlist_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type AllowListTest --abi artifacts/AllowListTest.abi --bin artifacts/AllowListTest.bin --out gen_allowlisttest_binding.go diff --git a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go index 4ce13be5dd..0821381c0f 100644 --- a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go +++ b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go @@ -31,8 +31,8 @@ var ( // AllowListTestMetaData contains all meta data concerning the AllowListTest contract. var AllowListTestMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610ba1380380610ba1833981810160405281019061003191906100d6565b80805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050610101565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a58261007c565b9050919050565b6100b58161009b565b81146100bf575f5ffd5b50565b5f815190506100d0816100ac565b92915050565b5f602082840312156100eb576100ea610078565b5b5f6100f8848285016100c2565b91505092915050565b610a938061010e5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806374a8f1031161005957806374a8f103146100fc5780639015d37114610118578063d0ebdbe714610148578063f3ae24151461016457610086565b80630aaf70431461008a57806324d7806c146100a65780636cd5c39b146100d6578063704b6c02146100e0575b5f5ffd5b6100a4600480360381019061009f9190610841565b610194565b005b6100c060048036038101906100bb9190610841565b6101f8565b6040516100cd9190610886565b60405180910390f35b6100de6102a0565b005b6100fa60048036038101906100f59190610841565b6102c9565b005b61011660048036038101906101119190610841565b61032d565b005b610132600480360381019061012d9190610841565b610391565b60405161013f9190610886565b60405180910390f35b610162600480360381019061015d9190610841565b610439565b005b61017e60048036038101906101799190610841565b61049d565b60405161018b9190610886565b60405180910390f35b61019d336101f8565b806101ad57506101ac3361049d565b5b6101ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101e3906108f9565b60405180910390fd5b6101f581610545565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102539190610926565b602060405180830381865afa15801561026e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102929190610972565b905060028114915050919050565b6040516102ac906107d7565b604051809103905ff0801580156102c5573d5f5f3e3d5ffd5b5050565b6102d2336101f8565b806102e257506102e13361049d565b5b610321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610318906108f9565b60405180910390fd5b61032a816105ce565b50565b610336336101f8565b8061034657506103453361049d565b5b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906108f9565b60405180910390fd5b61038e81610657565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016103ec9190610926565b602060405180830381865afa158015610407573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061042b9190610972565b90505f811415915050919050565b610442336101f8565b8061045257506104513361049d565b5b610491576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610488906108f9565b60405180910390fd5b61049a8161074e565b50565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016104f89190610926565b602060405180830381865afa158015610513573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105379190610972565b905060038114915050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161059e9190610926565b5f604051808303815f87803b1580156105b5575f5ffd5b505af11580156105c7573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016106279190610926565b5f604051808303815f87803b15801561063e575f5ffd5b505af1158015610650573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16036106c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106bc906109e7565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161071e9190610926565b5f604051808303815f87803b158015610735575f5ffd5b505af1158015610747573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b81526004016107a79190610926565b5f604051808303815f87803b1580156107be575f5ffd5b505af11580156107d0573d5f5f3e3d5ffd5b5050505050565b605880610a0683390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610810826107e7565b9050919050565b61082081610806565b811461082a575f5ffd5b50565b5f8135905061083b81610817565b92915050565b5f60208284031215610856576108556107e3565b5b5f6108638482850161082d565b91505092915050565b5f8115159050919050565b6108808161086c565b82525050565b5f6020820190506108995f830184610877565b92915050565b5f82825260208201905092915050565b7f63616e6e6f74206d6f6469667920616c6c6f77206c69737400000000000000005f82015250565b5f6108e360188361089f565b91506108ee826108af565b602082019050919050565b5f6020820190508181035f830152610910816108d7565b9050919050565b61092081610806565b82525050565b5f6020820190506109395f830184610917565b92915050565b5f819050919050565b6109518161093f565b811461095b575f5ffd5b50565b5f8151905061096c81610948565b92915050565b5f60208284031215610987576109866107e3565b5b5f6109948482850161095e565b91505092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f6109d160168361089f565b91506109dc8261099d565b602082019050919050565b5f6020820190508181035f8301526109fe816109c5565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220a6f35569427acc58ad5367cdacdafc7cbf00ed36744b876fba3bd8433689c4a564736f6c634300081e0033a2646970667358221220b9610a9e66cd5a3a7c0ccc575d7228dff9f3846ffc78cf4eccd34dd152f9297664736f6c634300081e0033", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"readAllowList\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setNone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561000f575f5ffd5b50604051610b4b380380610b4b833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610a3f8061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c80638c6bfb3b116100645780638c6bfb3b1461012e5780639015d3711461014a578063d0ebdbe71461017a578063eb54dae114610196578063f3ae2415146101c65761009c565b80630aaf7043146100a057806324d7806c146100bc5780636cd5c39b146100ec578063704b6c02146100f657806374a8f10314610112575b5f5ffd5b6100ba60048036038101906100b5919061082d565b6101f6565b005b6100d660048036038101906100d1919061082d565b61027f565b6040516100e39190610872565b60405180910390f35b6100f4610322565b005b610110600480360381019061010b919061082d565b61034b565b005b61012c6004803603810190610127919061082d565b6103d4565b005b6101486004803603810190610143919061082d565b6104cb565b005b610164600480360381019061015f919061082d565b610554565b6040516101719190610872565b60405180910390f35b610194600480360381019061018f919061082d565b6105f7565b005b6101b060048036038101906101ab919061082d565b610680565b6040516101bd91906108a3565b60405180910390f35b6101e060048036038101906101db919061082d565b610720565b6040516101ed9190610872565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161024f91906108cb565b5f604051808303815f87803b158015610266575f5ffd5b505af1158015610278573d5f5f3e3d5ffd5b5050505050565b5f60025f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102db91906108cb565b602060405180830381865afa1580156102f6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031a919061090e565b149050919050565b60405161032e906107c3565b604051809103905ff080158015610347573d5f5f3e3d5ffd5b5050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016103a491906108cb565b5f604051808303815f87803b1580156103bb575f5ffd5b505af11580156103cd573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043990610993565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161049b91906108cb565b5f604051808303815f87803b1580156104b2575f5ffd5b505af11580156104c4573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161052491906108cb565b5f604051808303815f87803b15801561053b575f5ffd5b505af115801561054d573d5f5f3e3d5ffd5b5050505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016105af91906108cb565b602060405180830381865afa1580156105ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ee919061090e565b14159050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b815260040161065091906108cb565b5f604051808303815f87803b158015610667575f5ffd5b505af1158015610679573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1836040518263ffffffff1660e01b81526004016106da91906108cb565b602060405180830381865afa1580156106f5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610719919061090e565b9050919050565b5f60035f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161077c91906108cb565b602060405180830381865afa158015610797573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb919061090e565b149050919050565b6058806109b283390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107fc826107d3565b9050919050565b61080c816107f2565b8114610816575f5ffd5b50565b5f8135905061082781610803565b92915050565b5f60208284031215610842576108416107cf565b5b5f61084f84828501610819565b91505092915050565b5f8115159050919050565b61086c81610858565b82525050565b5f6020820190506108855f830184610863565b92915050565b5f819050919050565b61089d8161088b565b82525050565b5f6020820190506108b65f830184610894565b92915050565b6108c5816107f2565b82525050565b5f6020820190506108de5f8301846108bc565b92915050565b6108ed8161088b565b81146108f7575f5ffd5b50565b5f81519050610908816108e4565b92915050565b5f60208284031215610923576109226107cf565b5b5f610930848285016108fa565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f61097d601683610939565b915061098882610949565b602082019050919050565b5f6020820190508181035f8301526109aa81610971565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220b0ed749ed87f2930579cf1432b0e6f14fd5bab5e60b34347b1aaa7e16131670764736f6c634300081e0033a2646970667358221220121e347e2879baa6ffadb2daddae7dcbc7355051845d98c687fa2dbbdeda43aa64736f6c634300081e0033", } // AllowListTestABI is the input ABI used to generate the binding from. @@ -295,6 +295,37 @@ func (_AllowListTest *AllowListTestCallerSession) IsManager(addr common.Address) return _AllowListTest.Contract.IsManager(&_AllowListTest.CallOpts, addr) } +// ReadAllowList is a free data retrieval call binding the contract method 0xeb54dae1. +// +// Solidity: function readAllowList(address addr) view returns(uint256) +func (_AllowListTest *AllowListTestCaller) ReadAllowList(opts *bind.CallOpts, addr common.Address) (*big.Int, error) { + var out []interface{} + err := _AllowListTest.contract.Call(opts, &out, "readAllowList", addr) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// ReadAllowList is a free data retrieval call binding the contract method 0xeb54dae1. +// +// Solidity: function readAllowList(address addr) view returns(uint256) +func (_AllowListTest *AllowListTestSession) ReadAllowList(addr common.Address) (*big.Int, error) { + return _AllowListTest.Contract.ReadAllowList(&_AllowListTest.CallOpts, addr) +} + +// ReadAllowList is a free data retrieval call binding the contract method 0xeb54dae1. +// +// Solidity: function readAllowList(address addr) view returns(uint256) +func (_AllowListTest *AllowListTestCallerSession) ReadAllowList(addr common.Address) (*big.Int, error) { + return _AllowListTest.Contract.ReadAllowList(&_AllowListTest.CallOpts, addr) +} + // DeployContract is a paid mutator transaction binding the contract method 0x6cd5c39b. // // Solidity: function deployContract() returns() @@ -399,3 +430,24 @@ func (_AllowListTest *AllowListTestSession) SetManager(addr common.Address) (*ty func (_AllowListTest *AllowListTestTransactorSession) SetManager(addr common.Address) (*types.Transaction, error) { return _AllowListTest.Contract.SetManager(&_AllowListTest.TransactOpts, addr) } + +// SetNone is a paid mutator transaction binding the contract method 0x8c6bfb3b. +// +// Solidity: function setNone(address addr) returns() +func (_AllowListTest *AllowListTestTransactor) SetNone(opts *bind.TransactOpts, addr common.Address) (*types.Transaction, error) { + return _AllowListTest.contract.Transact(opts, "setNone", addr) +} + +// SetNone is a paid mutator transaction binding the contract method 0x8c6bfb3b. +// +// Solidity: function setNone(address addr) returns() +func (_AllowListTest *AllowListTestSession) SetNone(addr common.Address) (*types.Transaction, error) { + return _AllowListTest.Contract.SetNone(&_AllowListTest.TransactOpts, addr) +} + +// SetNone is a paid mutator transaction binding the contract method 0x8c6bfb3b. +// +// Solidity: function setNone(address addr) returns() +func (_AllowListTest *AllowListTestTransactorSession) SetNone(addr common.Address) (*types.Transaction, error) { + return _AllowListTest.Contract.SetNone(&_AllowListTest.TransactOpts, addr) +} diff --git a/precompile/contracts/feemanager/IFeeManager.sol b/precompile/contracts/feemanager/IFeeManager.sol new file mode 100644 index 0000000000..b8a587bd93 --- /dev/null +++ b/precompile/contracts/feemanager/IFeeManager.sol @@ -0,0 +1,54 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; +import "precompile/allowlist/IAllowList.sol"; + +interface IFeeManager is IAllowList { + struct FeeConfig { + uint256 gasLimit; + uint256 targetBlockRate; + uint256 minBaseFee; + uint256 targetGas; + uint256 baseFeeChangeDenominator; + uint256 minBlockGasCost; + uint256 maxBlockGasCost; + uint256 blockGasCostStep; + } + event FeeConfigChanged( + address indexed sender, + FeeConfig oldFeeConfig, + FeeConfig newFeeConfig + ); + + // Set fee config fields to contract storage + function setFeeConfig( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) external; + + // Get fee config from the contract storage + function getFeeConfig() + external + view + returns ( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ); + + // Get the last block number changed the fee config from the contract storage + function getFeeConfigLastChangedAt() + external + view + returns (uint256 blockNumber); +} diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol b/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol index f252b0f9fc..31ec69bcb4 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol +++ b/precompile/contracts/feemanager/feemanagertest/bindings/FeeManagerTest.sol @@ -1,7 +1,7 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "./IFeeManager.sol"; +import "precompile/contracts/feemanager/IFeeManager.sol"; contract FeeManagerTest { IFeeManager private feeManager; diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol b/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol deleted file mode 100644 index a49234e326..0000000000 --- a/precompile/contracts/feemanager/feemanagertest/bindings/IFeeManager.sol +++ /dev/null @@ -1,47 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; -import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; - -interface IFeeManager is IAllowList { - struct FeeConfig { - uint256 gasLimit; - uint256 targetBlockRate; - uint256 minBaseFee; - uint256 targetGas; - uint256 baseFeeChangeDenominator; - uint256 minBlockGasCost; - uint256 maxBlockGasCost; - uint256 blockGasCostStep; - } - event FeeConfigChanged(address indexed sender, FeeConfig oldFeeConfig, FeeConfig newFeeConfig); - - // Set fee config fields to contract storage - function setFeeConfig( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) external; - - // Get fee config from the contract storage - function getFeeConfig() - external - view - returns ( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ); - - // Get the last block number changed the fee config from the contract storage - function getFeeConfigLastChangedAt() external view returns (uint256 blockNumber); -} diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go index bf39c61e76..14d8e139a1 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go @@ -32,7 +32,7 @@ var ( // FeeManagerTestMetaData contains all meta data concerning the FeeManagerTest contract. var FeeManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getFeeConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeeConfigLastChangedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"name\":\"setFeeConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea26469706673582212202589a5e482d11e8833ad4feb162fb81f20fc80dedb5b2e63ec163cabd71ae43264736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea26469706673582212203a7d0bed2de4939634037be385d04f2da43fe9e59ba8eb0d6630494973903e4964736f6c634300081e0033", } // FeeManagerTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/nativeminter/INativeMinter.sol b/precompile/contracts/nativeminter/INativeMinter.sol new file mode 100644 index 0000000000..58341a1829 --- /dev/null +++ b/precompile/contracts/nativeminter/INativeMinter.sol @@ -0,0 +1,13 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; +import "precompile/allowlist/IAllowList.sol"; + +interface INativeMinter is IAllowList { + event NativeCoinMinted( + address indexed sender, + address indexed recipient, + uint256 amount + ); + // Mint [amount] number of native coins and send to [addr] + function mintNativeCoin(address addr, uint256 amount) external; +} diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol b/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol deleted file mode 100644 index 7fd63a55c9..0000000000 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/INativeMinter.sol +++ /dev/null @@ -1,9 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; -import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; - -interface INativeMinter is IAllowList { - event NativeCoinMinted(address indexed sender, address indexed recipient, uint256 amount); - // Mint [amount] number of native coins and send to [addr] - function mintNativeCoin(address addr, uint256 amount) external; -} diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol b/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol index 7220cf35b4..e44a7cdcdd 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/NativeMinterTest.sol @@ -1,7 +1,7 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "./INativeMinter.sol"; +import "precompile/contracts/nativeminter/INativeMinter.sol"; contract NativeMinterTest { INativeMinter private nativeMinter; diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index 696d206166..33ca73184d 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea264697066735822122022a495ab74b25db78e2d373ef8499eee646e53fb4eb515ac693575252359c1ae64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea26469706673582212205a0f0d7f10d4a50f070cfcd12f2dbe97d85b8971e1cd0c259e72827654926b7264736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol b/precompile/contracts/rewardmanager/IRewardManager.sol similarity index 94% rename from precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol rename to precompile/contracts/rewardmanager/IRewardManager.sol index bf0b484562..b017d7a753 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/IRewardManager.sol +++ b/precompile/contracts/rewardmanager/IRewardManager.sol @@ -1,6 +1,6 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "precompile/allowlist/allowlisttest/bindings/IAllowList.sol"; +import "precompile/allowlist/IAllowList.sol"; interface IRewardManager is IAllowList { // RewardAddressChanged is the event logged whenever reward address is modified diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol index 33dd1ab8cd..331d4c8ed5 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/RewardManagerTest.sol @@ -1,7 +1,7 @@ //SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import "./IRewardManager.sol"; +import "precompile/contracts/rewardmanager/IRewardManager.sol"; contract RewardManagerTest { IRewardManager private rewardManager; diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go index 9542888f9d..d9f4ed0fbc 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/compile.go @@ -4,7 +4,7 @@ package bindings // Step 1: Compile Solidity contracts to generate ABI and bin files -//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../.. precompile/=precompile/ --evm-version cancun RewardManagerTest.sol IRewardManager.sol +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../.. precompile/=precompile/ --evm-version cancun RewardManagerTest.sol // Step 2: Generate Go bindings from the compiled artifacts //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IRewardManager --abi artifacts/IRewardManager.abi --bin artifacts/IRewardManager.bin --out gen_irewardmanager_binding.go //go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type RewardManagerTest --abi artifacts/RewardManagerTest.abi --bin artifacts/RewardManagerTest.bin --out gen_rewardmanagertest_binding.go diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go index 8a0c62d2ef..64405448ed 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -32,7 +32,7 @@ var ( // RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. var RewardManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220ccd3262a78a2a69cdedd481e181692ee33d9480f66c85047c9603b3398a906d064736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea26469706673582212205b6a72afb8b3c129315cb273e930839b83611ddf6f7d88533e28febd0011f65664736f6c634300081e0033", } // RewardManagerTestABI is the input ABI used to generate the binding from. From 34023f31857fff4c99a91441d6faf5203873fee9 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 14:03:10 -0500 Subject: [PATCH 50/73] chore: git track move --- precompile/allowlist/IAllowList.sol | 29 +++---- .../contracts/feemanager/IFeeManager.sol | 83 +++++++++---------- .../contracts/nativeminter/INativeMinter.sol | 10 +-- 3 files changed, 53 insertions(+), 69 deletions(-) diff --git a/precompile/allowlist/IAllowList.sol b/precompile/allowlist/IAllowList.sol index 2e031d0bf1..1ca465e3d6 100644 --- a/precompile/allowlist/IAllowList.sol +++ b/precompile/allowlist/IAllowList.sol @@ -2,25 +2,20 @@ pragma solidity ^0.8.24; interface IAllowList { - event RoleSet( - uint256 indexed role, - address indexed account, - address indexed sender, - uint256 oldRole - ); + event RoleSet(uint256 indexed role, address indexed account, address indexed sender, uint256 oldRole); - // Set [addr] to have the admin role over the precompile contract. - function setAdmin(address addr) external; + // Set [addr] to have the admin role over the precompile contract. + function setAdmin(address addr) external; - // Set [addr] to be enabled on the precompile contract. - function setEnabled(address addr) external; + // Set [addr] to be enabled on the precompile contract. + function setEnabled(address addr) external; - // Set [addr] to have the manager role over the precompile contract. - function setManager(address addr) external; + // Set [addr] to have the manager role over the precompile contract. + function setManager(address addr) external; - // Set [addr] to have no role for the precompile contract. - function setNone(address addr) external; + // Set [addr] to have no role for the precompile contract. + function setNone(address addr) external; - // Read the status of [addr]. - function readAllowList(address addr) external view returns (uint256 role); -} + // Read the status of [addr]. + function readAllowList(address addr) external view returns (uint256 role); +} \ No newline at end of file diff --git a/precompile/contracts/feemanager/IFeeManager.sol b/precompile/contracts/feemanager/IFeeManager.sol index b8a587bd93..809dc91df7 100644 --- a/precompile/contracts/feemanager/IFeeManager.sol +++ b/precompile/contracts/feemanager/IFeeManager.sol @@ -3,52 +3,45 @@ pragma solidity ^0.8.24; import "precompile/allowlist/IAllowList.sol"; interface IFeeManager is IAllowList { - struct FeeConfig { - uint256 gasLimit; - uint256 targetBlockRate; - uint256 minBaseFee; - uint256 targetGas; - uint256 baseFeeChangeDenominator; - uint256 minBlockGasCost; - uint256 maxBlockGasCost; - uint256 blockGasCostStep; - } - event FeeConfigChanged( - address indexed sender, - FeeConfig oldFeeConfig, - FeeConfig newFeeConfig - ); + struct FeeConfig { + uint256 gasLimit; + uint256 targetBlockRate; + uint256 minBaseFee; + uint256 targetGas; + uint256 baseFeeChangeDenominator; + uint256 minBlockGasCost; + uint256 maxBlockGasCost; + uint256 blockGasCostStep; + } + event FeeConfigChanged(address indexed sender, FeeConfig oldFeeConfig, FeeConfig newFeeConfig); - // Set fee config fields to contract storage - function setFeeConfig( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ) external; + // Set fee config fields to contract storage + function setFeeConfig( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ) external; - // Get fee config from the contract storage - function getFeeConfig() - external - view - returns ( - uint256 gasLimit, - uint256 targetBlockRate, - uint256 minBaseFee, - uint256 targetGas, - uint256 baseFeeChangeDenominator, - uint256 minBlockGasCost, - uint256 maxBlockGasCost, - uint256 blockGasCostStep - ); + // Get fee config from the contract storage + function getFeeConfig() + external + view + returns ( + uint256 gasLimit, + uint256 targetBlockRate, + uint256 minBaseFee, + uint256 targetGas, + uint256 baseFeeChangeDenominator, + uint256 minBlockGasCost, + uint256 maxBlockGasCost, + uint256 blockGasCostStep + ); - // Get the last block number changed the fee config from the contract storage - function getFeeConfigLastChangedAt() - external - view - returns (uint256 blockNumber); + // Get the last block number changed the fee config from the contract storage + function getFeeConfigLastChangedAt() external view returns (uint256 blockNumber); } diff --git a/precompile/contracts/nativeminter/INativeMinter.sol b/precompile/contracts/nativeminter/INativeMinter.sol index 58341a1829..0cea7e8d9d 100644 --- a/precompile/contracts/nativeminter/INativeMinter.sol +++ b/precompile/contracts/nativeminter/INativeMinter.sol @@ -3,11 +3,7 @@ pragma solidity ^0.8.24; import "precompile/allowlist/IAllowList.sol"; interface INativeMinter is IAllowList { - event NativeCoinMinted( - address indexed sender, - address indexed recipient, - uint256 amount - ); - // Mint [amount] number of native coins and send to [addr] - function mintNativeCoin(address addr, uint256 amount) external; + event NativeCoinMinted(address indexed sender, address indexed recipient, uint256 amount); + // Mint [amount] number of native coins and send to [addr] + function mintNativeCoin(address addr, uint256 amount) external; } From 607a237e7f0ad852d8fd36546ed33a0fce66f84f Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 14:16:02 -0500 Subject: [PATCH 51/73] chore: regenerate bindings --- .../allowlisttest/bindings/gen_allowlisttest_binding.go | 2 +- .../feemanagertest/bindings/gen_feemanagertest_binding.go | 2 +- .../nativemintertest/bindings/gen_nativemintertest_binding.go | 2 +- .../rewardmanagertest/bindings/gen_rewardmanagertest_binding.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go index 0821381c0f..1d487801d7 100644 --- a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go +++ b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go @@ -32,7 +32,7 @@ var ( // AllowListTestMetaData contains all meta data concerning the AllowListTest contract. var AllowListTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"readAllowList\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setNone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610b4b380380610b4b833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610a3f8061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c80638c6bfb3b116100645780638c6bfb3b1461012e5780639015d3711461014a578063d0ebdbe71461017a578063eb54dae114610196578063f3ae2415146101c65761009c565b80630aaf7043146100a057806324d7806c146100bc5780636cd5c39b146100ec578063704b6c02146100f657806374a8f10314610112575b5f5ffd5b6100ba60048036038101906100b5919061082d565b6101f6565b005b6100d660048036038101906100d1919061082d565b61027f565b6040516100e39190610872565b60405180910390f35b6100f4610322565b005b610110600480360381019061010b919061082d565b61034b565b005b61012c6004803603810190610127919061082d565b6103d4565b005b6101486004803603810190610143919061082d565b6104cb565b005b610164600480360381019061015f919061082d565b610554565b6040516101719190610872565b60405180910390f35b610194600480360381019061018f919061082d565b6105f7565b005b6101b060048036038101906101ab919061082d565b610680565b6040516101bd91906108a3565b60405180910390f35b6101e060048036038101906101db919061082d565b610720565b6040516101ed9190610872565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161024f91906108cb565b5f604051808303815f87803b158015610266575f5ffd5b505af1158015610278573d5f5f3e3d5ffd5b5050505050565b5f60025f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102db91906108cb565b602060405180830381865afa1580156102f6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031a919061090e565b149050919050565b60405161032e906107c3565b604051809103905ff080158015610347573d5f5f3e3d5ffd5b5050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016103a491906108cb565b5f604051808303815f87803b1580156103bb575f5ffd5b505af11580156103cd573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043990610993565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161049b91906108cb565b5f604051808303815f87803b1580156104b2575f5ffd5b505af11580156104c4573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161052491906108cb565b5f604051808303815f87803b15801561053b575f5ffd5b505af115801561054d573d5f5f3e3d5ffd5b5050505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016105af91906108cb565b602060405180830381865afa1580156105ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ee919061090e565b14159050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b815260040161065091906108cb565b5f604051808303815f87803b158015610667575f5ffd5b505af1158015610679573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1836040518263ffffffff1660e01b81526004016106da91906108cb565b602060405180830381865afa1580156106f5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610719919061090e565b9050919050565b5f60035f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161077c91906108cb565b602060405180830381865afa158015610797573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb919061090e565b149050919050565b6058806109b283390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107fc826107d3565b9050919050565b61080c816107f2565b8114610816575f5ffd5b50565b5f8135905061082781610803565b92915050565b5f60208284031215610842576108416107cf565b5b5f61084f84828501610819565b91505092915050565b5f8115159050919050565b61086c81610858565b82525050565b5f6020820190506108855f830184610863565b92915050565b5f819050919050565b61089d8161088b565b82525050565b5f6020820190506108b65f830184610894565b92915050565b6108c5816107f2565b82525050565b5f6020820190506108de5f8301846108bc565b92915050565b6108ed8161088b565b81146108f7575f5ffd5b50565b5f81519050610908816108e4565b92915050565b5f60208284031215610923576109226107cf565b5b5f610930848285016108fa565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f61097d601683610939565b915061098882610949565b602082019050919050565b5f6020820190508181035f8301526109aa81610971565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220b0ed749ed87f2930579cf1432b0e6f14fd5bab5e60b34347b1aaa7e16131670764736f6c634300081e0033a2646970667358221220121e347e2879baa6ffadb2daddae7dcbc7355051845d98c687fa2dbbdeda43aa64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610b4b380380610b4b833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610a3f8061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c80638c6bfb3b116100645780638c6bfb3b1461012e5780639015d3711461014a578063d0ebdbe71461017a578063eb54dae114610196578063f3ae2415146101c65761009c565b80630aaf7043146100a057806324d7806c146100bc5780636cd5c39b146100ec578063704b6c02146100f657806374a8f10314610112575b5f5ffd5b6100ba60048036038101906100b5919061082d565b6101f6565b005b6100d660048036038101906100d1919061082d565b61027f565b6040516100e39190610872565b60405180910390f35b6100f4610322565b005b610110600480360381019061010b919061082d565b61034b565b005b61012c6004803603810190610127919061082d565b6103d4565b005b6101486004803603810190610143919061082d565b6104cb565b005b610164600480360381019061015f919061082d565b610554565b6040516101719190610872565b60405180910390f35b610194600480360381019061018f919061082d565b6105f7565b005b6101b060048036038101906101ab919061082d565b610680565b6040516101bd91906108a3565b60405180910390f35b6101e060048036038101906101db919061082d565b610720565b6040516101ed9190610872565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161024f91906108cb565b5f604051808303815f87803b158015610266575f5ffd5b505af1158015610278573d5f5f3e3d5ffd5b5050505050565b5f60025f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102db91906108cb565b602060405180830381865afa1580156102f6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031a919061090e565b149050919050565b60405161032e906107c3565b604051809103905ff080158015610347573d5f5f3e3d5ffd5b5050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016103a491906108cb565b5f604051808303815f87803b1580156103bb575f5ffd5b505af11580156103cd573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043990610993565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161049b91906108cb565b5f604051808303815f87803b1580156104b2575f5ffd5b505af11580156104c4573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161052491906108cb565b5f604051808303815f87803b15801561053b575f5ffd5b505af115801561054d573d5f5f3e3d5ffd5b5050505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016105af91906108cb565b602060405180830381865afa1580156105ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ee919061090e565b14159050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b815260040161065091906108cb565b5f604051808303815f87803b158015610667575f5ffd5b505af1158015610679573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1836040518263ffffffff1660e01b81526004016106da91906108cb565b602060405180830381865afa1580156106f5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610719919061090e565b9050919050565b5f60035f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161077c91906108cb565b602060405180830381865afa158015610797573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb919061090e565b149050919050565b6058806109b283390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107fc826107d3565b9050919050565b61080c816107f2565b8114610816575f5ffd5b50565b5f8135905061082781610803565b92915050565b5f60208284031215610842576108416107cf565b5b5f61084f84828501610819565b91505092915050565b5f8115159050919050565b61086c81610858565b82525050565b5f6020820190506108855f830184610863565b92915050565b5f819050919050565b61089d8161088b565b82525050565b5f6020820190506108b65f830184610894565b92915050565b6108c5816107f2565b82525050565b5f6020820190506108de5f8301846108bc565b92915050565b6108ed8161088b565b81146108f7575f5ffd5b50565b5f81519050610908816108e4565b92915050565b5f60208284031215610923576109226107cf565b5b5f610930848285016108fa565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f61097d601683610939565b915061098882610949565b602082019050919050565b5f6020820190508181035f8301526109aa81610971565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea26469706673582212208a5bc8a7b93e2c0f0a241672431e82f50bbb4139ff697657704bf0aee79f627e64736f6c634300081e0033a26469706673582212202b59ccfa68fda71ece325df8f6a5a8c3c714b63c0c499cdfb6816b50adf71a1164736f6c634300081e0033", } // AllowListTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go index 14d8e139a1..9ff78d07fb 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go @@ -32,7 +32,7 @@ var ( // FeeManagerTestMetaData contains all meta data concerning the FeeManagerTest contract. var FeeManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getFeeConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeeConfigLastChangedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"name\":\"setFeeConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea26469706673582212203a7d0bed2de4939634037be385d04f2da43fe9e59ba8eb0d6630494973903e4964736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220f391e9a1d5d556a8d7226325f6fdfb686b065d38e58b1cb4edab2a6b9d4330c364736f6c634300081e0033", } // FeeManagerTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index 33ca73184d..e2b5775eb8 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea26469706673582212205a0f0d7f10d4a50f070cfcd12f2dbe97d85b8971e1cd0c259e72827654926b7264736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea264697066735822122050e9d2c1d7f897401745e829bb1e0994daee122973eda0e3a665cadd5030259b64736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go index 64405448ed..023db5173a 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -32,7 +32,7 @@ var ( // RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. var RewardManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea26469706673582212205b6a72afb8b3c129315cb273e930839b83611ddf6f7d88533e28febd0011f65664736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220ed22c586ee8598087f4eba32fd59beac21b373cf65a5fe8e0b95fae5833c719f64736f6c634300081e0033", } // RewardManagerTestABI is the input ABI used to generate the binding from. From 6031f25e58c3b5b62fa284d66e1f6fe9ce6d8cb8 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 14:24:48 -0500 Subject: [PATCH 52/73] style: rename bindings test --- tests/warp/warp_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 18871046ff..c03e9ce4c1 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -170,8 +170,8 @@ var _ = ginkgo.Describe("[Warp]", func() { log.Info("Delivering block hash payload to receiving subnet") w.deliverBlockHashPayload() - log.Info("Verifying warp message and blockchain ID") - w.verifyWarpMessageAndBlockchainID() + log.Info("bindings test: verifying warp message and blockchain ID") + w.warpBindingsTest() log.Info("Executing warp load test") w.warpLoad() @@ -627,7 +627,7 @@ func (w *warpTest) deliverBlockHashPayload() { require.Equal(types.ReceiptStatusSuccessful, receipt.Status) } -func (w *warpTest) verifyWarpMessageAndBlockchainID() { +func (w *warpTest) warpBindingsTest() { require := require.New(ginkgo.GinkgoT()) tc := e2e.NewTestContext() ctx := tc.DefaultContext() From e0c9b792053e529f6ddb109961959d67ea7d3250 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 14:50:50 -0500 Subject: [PATCH 53/73] test: full warp bindings test --- .../IWarpMessenger.sol | 0 .../contracts/warp/warpbindings/compile.go | 12 + .../gen_iwarpmessenger_binding.go | 2 +- .../warp/warptest/bindings/WarpTest.sol | 37 ++ .../warp/warptest/bindings/compile.go | 11 +- .../warptest/bindings/gen_warptest_binding.go | 358 ++++++++++++++++++ tests/warp/warp_test.go | 93 ++++- 7 files changed, 487 insertions(+), 26 deletions(-) rename precompile/contracts/warp/{warptest/bindings => warpbindings}/IWarpMessenger.sol (100%) create mode 100644 precompile/contracts/warp/warpbindings/compile.go rename precompile/contracts/warp/{warptest/bindings => warpbindings}/gen_iwarpmessenger_binding.go (99%) create mode 100644 precompile/contracts/warp/warptest/bindings/WarpTest.sol create mode 100644 precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go diff --git a/precompile/contracts/warp/warptest/bindings/IWarpMessenger.sol b/precompile/contracts/warp/warpbindings/IWarpMessenger.sol similarity index 100% rename from precompile/contracts/warp/warptest/bindings/IWarpMessenger.sol rename to precompile/contracts/warp/warpbindings/IWarpMessenger.sol diff --git a/precompile/contracts/warp/warpbindings/compile.go b/precompile/contracts/warp/warpbindings/compile.go new file mode 100644 index 0000000000..62cbdd5931 --- /dev/null +++ b/precompile/contracts/warp/warpbindings/compile.go @@ -0,0 +1,12 @@ +// Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. + +package warpbindings + +// Step 1: Compile Solidity contract to generate ABI and bin files +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --evm-version cancun IWarpMessenger.sol +// Step 2: Generate Go bindings from the compiled artifacts +//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg warpbindings --type IWarpMessenger --abi artifacts/IWarpMessenger.abi --bin artifacts/IWarpMessenger.bin --out gen_iwarpmessenger_binding.go +// Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm +// This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. +//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_iwarpmessenger_binding.go && rm -f gen_iwarpmessenger_binding.go.bak" diff --git a/precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go b/precompile/contracts/warp/warpbindings/gen_iwarpmessenger_binding.go similarity index 99% rename from precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go rename to precompile/contracts/warp/warpbindings/gen_iwarpmessenger_binding.go index 1cf8d9b8f3..72669f1377 100644 --- a/precompile/contracts/warp/warptest/bindings/gen_iwarpmessenger_binding.go +++ b/precompile/contracts/warp/warpbindings/gen_iwarpmessenger_binding.go @@ -1,7 +1,7 @@ // Code generated - DO NOT EDIT. // This file is a generated binding and any manual changes will be lost. -package bindings +package warpbindings import ( "errors" diff --git a/precompile/contracts/warp/warptest/bindings/WarpTest.sol b/precompile/contracts/warp/warptest/bindings/WarpTest.sol new file mode 100644 index 0000000000..426138d974 --- /dev/null +++ b/precompile/contracts/warp/warptest/bindings/WarpTest.sol @@ -0,0 +1,37 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; + +import "precompile/contracts/warp/warpbindings/IWarpMessenger.sol"; + +contract WarpTest { + IWarpMessenger private warp; + + constructor(address warpPrecompile) { + warp = IWarpMessenger(warpPrecompile); + } + + // Calls the getBlockchainID function on the precompile + function getBlockchainID() external view returns (bytes32) { + return warp.getBlockchainID(); + } + + // Calls the sendWarpMessage function on the precompile + function sendWarpMessage(bytes calldata payload) external returns (bytes32 messageID) { + return warp.sendWarpMessage(payload); + } + + // Calls the getVerifiedWarpMessage function on the precompile + function getVerifiedWarpMessage( + uint32 index + ) external view returns (WarpMessage memory message, bool valid) { + return warp.getVerifiedWarpMessage(index); + } + + // Calls the getVerifiedWarpBlockHash function on the precompile + function getVerifiedWarpBlockHash( + uint32 index + ) external view returns (WarpBlockHash memory warpBlockHash, bool valid) { + return warp.getVerifiedWarpBlockHash(index); + } +} + diff --git a/precompile/contracts/warp/warptest/bindings/compile.go b/precompile/contracts/warp/warptest/bindings/compile.go index 2c9476a993..a97b8c5a14 100644 --- a/precompile/contracts/warp/warptest/bindings/compile.go +++ b/precompile/contracts/warp/warptest/bindings/compile.go @@ -3,10 +3,13 @@ package bindings -// Step 1: Compile Solidity contracts to generate ABI and bin files -//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --evm-version cancun IWarpMessenger.sol +// Step 1: Compile Solidity contract to generate ABI and bin files +// Uses base-path to resolve imports from the repo root +//go:generate solc-v0.8.30 -o artifacts --overwrite --abi --bin --base-path ../../../../.. precompile/=precompile/ --evm-version cancun WarpTest.sol // Step 2: Generate Go bindings from the compiled artifacts -//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type IWarpMessenger --abi artifacts/IWarpMessenger.abi --bin artifacts/IWarpMessenger.bin --out gen_iwarpmessenger_binding.go +// WarpTest binding includes WarpMessage and WarpBlockHash struct definitions. +// For event filtering, use the IWarpMessenger binding from the warpbindings package. +//go:generate go run github.com/ava-labs/libevm/cmd/abigen --pkg bindings --type WarpTest --abi artifacts/WarpTest.abi --bin artifacts/WarpTest.bin --out gen_warptest_binding.go // Step 3: Replace import paths in generated binding to use subnet-evm instead of libevm // This is necessary because the libevm bindings package is not compatible with the subnet-evm simulated backend, which is used for testing. -//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_iwarpmessenger_binding.go && rm -f gen_iwarpmessenger_binding.go.bak" +//go:generate sh -c "sed -i.bak -e 's|github.com/ava-labs/libevm/accounts/abi|github.com/ava-labs/subnet-evm/accounts/abi|g' -e 's|github.com/ava-labs/libevm/accounts/abi/bind|github.com/ava-labs/subnet-evm/accounts/abi/bind|g' gen_warptest_binding.go && rm -f gen_warptest_binding.go.bak" diff --git a/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go b/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go new file mode 100644 index 0000000000..95f5d24ca6 --- /dev/null +++ b/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go @@ -0,0 +1,358 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package bindings + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ava-labs/libevm" + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/libevm/common" + "github.com/ava-labs/libevm/core/types" + "github.com/ava-labs/libevm/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// WarpBlockHash is an auto generated low-level Go binding around an user-defined struct. +type WarpBlockHash struct { + SourceChainID [32]byte + BlockHash [32]byte +} + +// WarpMessage is an auto generated low-level Go binding around an user-defined struct. +type WarpMessage struct { + SourceChainID [32]byte + OriginSenderAddress common.Address + Payload []byte +} + +// WarpTestMetaData contains all meta data concerning the WarpTest contract. +var WarpTestMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"warpPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpBlockHash\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"internalType\":\"structWarpBlockHash\",\"name\":\"warpBlockHash\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpMessage\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"internalType\":\"structWarpMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"sendWarpMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405234801561000f575f5ffd5b50604051610bd5380380610bd5833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610ac98061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634213cf781461004e5780636f8253501461006c578063ce7f59291461009d578063ee5b48eb146100ce575b5f5ffd5b6100566100fe565b60405161006391906103f1565b60405180910390f35b61008660048036038101906100819190610454565b610191565b6040516100949291906105a4565b60405180910390f35b6100b760048036038101906100b29190610454565b61023e565b6040516100c59291906105ff565b60405180910390f35b6100e860048036038101906100e39190610687565b6102e8565b6040516100f591906103f1565b60405180910390f35b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061018c91906106fc565b905090565b61019961038c565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350846040518263ffffffff1660e01b81526004016101f39190610736565b5f60405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906102359190610942565b91509150915091565b6102466103c1565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929846040518263ffffffff1660e01b81526004016102a09190610736565b606060405180830381865afa1580156102bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102df91906109e9565b91509150915091565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee5b48eb84846040518363ffffffff1660e01b8152600401610344929190610a71565b6020604051808303815f875af1158015610360573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061038491906106fc565b905092915050565b60405180606001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff168152602001606081525090565b60405180604001604052805f81526020015f81525090565b5f819050919050565b6103eb816103d9565b82525050565b5f6020820190506104045f8301846103e2565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f63ffffffff82169050919050565b6104338161041b565b811461043d575f5ffd5b50565b5f8135905061044e8161042a565b92915050565b5f6020828403121561046957610468610413565b5b5f61047684828501610440565b91505092915050565b610488816103d9565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6104b78261048e565b9050919050565b6104c7816104ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61050f826104cd565b61051981856104d7565b93506105298185602086016104e7565b610532816104f5565b840191505092915050565b5f606083015f8301516105525f86018261047f565b50602083015161056560208601826104be565b506040830151848203604086015261057d8282610505565b9150508091505092915050565b5f8115159050919050565b61059e8161058a565b82525050565b5f6040820190508181035f8301526105bc818561053d565b90506105cb6020830184610595565b9392505050565b604082015f8201516105e65f85018261047f565b5060208201516105f9602085018261047f565b50505050565b5f6060820190506106125f8301856105d2565b61061f6040830184610595565b9392505050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261064757610646610626565b5b8235905067ffffffffffffffff8111156106645761066361062a565b5b6020830191508360018202830111156106805761067f61062e565b5b9250929050565b5f5f6020838503121561069d5761069c610413565b5b5f83013567ffffffffffffffff8111156106ba576106b9610417565b5b6106c685828601610632565b92509250509250929050565b6106db816103d9565b81146106e5575f5ffd5b50565b5f815190506106f6816106d2565b92915050565b5f6020828403121561071157610710610413565b5b5f61071e848285016106e8565b91505092915050565b6107308161041b565b82525050565b5f6020820190506107495f830184610727565b92915050565b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610789826104f5565b810181811067ffffffffffffffff821117156107a8576107a7610753565b5b80604052505050565b5f6107ba61040a565b90506107c68282610780565b919050565b5f5ffd5b6107d8816104ad565b81146107e2575f5ffd5b50565b5f815190506107f3816107cf565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561081757610816610753565b5b610820826104f5565b9050602081019050919050565b5f61083f61083a846107fd565b6107b1565b90508281526020810184848401111561085b5761085a6107f9565b5b6108668482856104e7565b509392505050565b5f82601f83011261088257610881610626565b5b815161089284826020860161082d565b91505092915050565b5f606082840312156108b0576108af61074f565b5b6108ba60606107b1565b90505f6108c9848285016106e8565b5f8301525060206108dc848285016107e5565b602083015250604082015167ffffffffffffffff811115610900576108ff6107cb565b5b61090c8482850161086e565b60408301525092915050565b6109218161058a565b811461092b575f5ffd5b50565b5f8151905061093c81610918565b92915050565b5f5f6040838503121561095857610957610413565b5b5f83015167ffffffffffffffff81111561097557610974610417565b5b6109818582860161089b565b92505060206109928582860161092e565b9150509250929050565b5f604082840312156109b1576109b061074f565b5b6109bb60406107b1565b90505f6109ca848285016106e8565b5f8301525060206109dd848285016106e8565b60208301525092915050565b5f5f606083850312156109ff576109fe610413565b5b5f610a0c8582860161099c565b9250506040610a1d8582860161092e565b9150509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f610a508385610a27565b9350610a5d838584610a37565b610a66836104f5565b840190509392505050565b5f6020820190508181035f830152610a8a818486610a45565b9050939250505056fea2646970667358221220537e0b452c503ba2e974e6beed91913ed7b0dc136f3efe6b6ad3809139e7356364736f6c634300081e0033", +} + +// WarpTestABI is the input ABI used to generate the binding from. +// Deprecated: Use WarpTestMetaData.ABI instead. +var WarpTestABI = WarpTestMetaData.ABI + +// WarpTestBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use WarpTestMetaData.Bin instead. +var WarpTestBin = WarpTestMetaData.Bin + +// DeployWarpTest deploys a new Ethereum contract, binding an instance of WarpTest to it. +func DeployWarpTest(auth *bind.TransactOpts, backend bind.ContractBackend, warpPrecompile common.Address) (common.Address, *types.Transaction, *WarpTest, error) { + parsed, err := WarpTestMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(WarpTestBin), backend, warpPrecompile) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &WarpTest{WarpTestCaller: WarpTestCaller{contract: contract}, WarpTestTransactor: WarpTestTransactor{contract: contract}, WarpTestFilterer: WarpTestFilterer{contract: contract}}, nil +} + +// WarpTest is an auto generated Go binding around an Ethereum contract. +type WarpTest struct { + WarpTestCaller // Read-only binding to the contract + WarpTestTransactor // Write-only binding to the contract + WarpTestFilterer // Log filterer for contract events +} + +// WarpTestCaller is an auto generated read-only Go binding around an Ethereum contract. +type WarpTestCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// WarpTestTransactor is an auto generated write-only Go binding around an Ethereum contract. +type WarpTestTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// WarpTestFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type WarpTestFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// WarpTestSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type WarpTestSession struct { + Contract *WarpTest // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// WarpTestCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type WarpTestCallerSession struct { + Contract *WarpTestCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// WarpTestTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type WarpTestTransactorSession struct { + Contract *WarpTestTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// WarpTestRaw is an auto generated low-level Go binding around an Ethereum contract. +type WarpTestRaw struct { + Contract *WarpTest // Generic contract binding to access the raw methods on +} + +// WarpTestCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type WarpTestCallerRaw struct { + Contract *WarpTestCaller // Generic read-only contract binding to access the raw methods on +} + +// WarpTestTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type WarpTestTransactorRaw struct { + Contract *WarpTestTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewWarpTest creates a new instance of WarpTest, bound to a specific deployed contract. +func NewWarpTest(address common.Address, backend bind.ContractBackend) (*WarpTest, error) { + contract, err := bindWarpTest(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &WarpTest{WarpTestCaller: WarpTestCaller{contract: contract}, WarpTestTransactor: WarpTestTransactor{contract: contract}, WarpTestFilterer: WarpTestFilterer{contract: contract}}, nil +} + +// NewWarpTestCaller creates a new read-only instance of WarpTest, bound to a specific deployed contract. +func NewWarpTestCaller(address common.Address, caller bind.ContractCaller) (*WarpTestCaller, error) { + contract, err := bindWarpTest(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &WarpTestCaller{contract: contract}, nil +} + +// NewWarpTestTransactor creates a new write-only instance of WarpTest, bound to a specific deployed contract. +func NewWarpTestTransactor(address common.Address, transactor bind.ContractTransactor) (*WarpTestTransactor, error) { + contract, err := bindWarpTest(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &WarpTestTransactor{contract: contract}, nil +} + +// NewWarpTestFilterer creates a new log filterer instance of WarpTest, bound to a specific deployed contract. +func NewWarpTestFilterer(address common.Address, filterer bind.ContractFilterer) (*WarpTestFilterer, error) { + contract, err := bindWarpTest(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &WarpTestFilterer{contract: contract}, nil +} + +// bindWarpTest binds a generic wrapper to an already deployed contract. +func bindWarpTest(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := WarpTestMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_WarpTest *WarpTestRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _WarpTest.Contract.WarpTestCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_WarpTest *WarpTestRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _WarpTest.Contract.WarpTestTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_WarpTest *WarpTestRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _WarpTest.Contract.WarpTestTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_WarpTest *WarpTestCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _WarpTest.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_WarpTest *WarpTestTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _WarpTest.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_WarpTest *WarpTestTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _WarpTest.Contract.contract.Transact(opts, method, params...) +} + +// GetBlockchainID is a free data retrieval call binding the contract method 0x4213cf78. +// +// Solidity: function getBlockchainID() view returns(bytes32) +func (_WarpTest *WarpTestCaller) GetBlockchainID(opts *bind.CallOpts) ([32]byte, error) { + var out []interface{} + err := _WarpTest.contract.Call(opts, &out, "getBlockchainID") + + if err != nil { + return *new([32]byte), err + } + + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + + return out0, err + +} + +// GetBlockchainID is a free data retrieval call binding the contract method 0x4213cf78. +// +// Solidity: function getBlockchainID() view returns(bytes32) +func (_WarpTest *WarpTestSession) GetBlockchainID() ([32]byte, error) { + return _WarpTest.Contract.GetBlockchainID(&_WarpTest.CallOpts) +} + +// GetBlockchainID is a free data retrieval call binding the contract method 0x4213cf78. +// +// Solidity: function getBlockchainID() view returns(bytes32) +func (_WarpTest *WarpTestCallerSession) GetBlockchainID() ([32]byte, error) { + return _WarpTest.Contract.GetBlockchainID(&_WarpTest.CallOpts) +} + +// GetVerifiedWarpBlockHash is a free data retrieval call binding the contract method 0xce7f5929. +// +// Solidity: function getVerifiedWarpBlockHash(uint32 index) view returns((bytes32,bytes32) warpBlockHash, bool valid) +func (_WarpTest *WarpTestCaller) GetVerifiedWarpBlockHash(opts *bind.CallOpts, index uint32) (struct { + WarpBlockHash WarpBlockHash + Valid bool +}, error) { + var out []interface{} + err := _WarpTest.contract.Call(opts, &out, "getVerifiedWarpBlockHash", index) + + outstruct := new(struct { + WarpBlockHash WarpBlockHash + Valid bool + }) + if err != nil { + return *outstruct, err + } + + outstruct.WarpBlockHash = *abi.ConvertType(out[0], new(WarpBlockHash)).(*WarpBlockHash) + outstruct.Valid = *abi.ConvertType(out[1], new(bool)).(*bool) + + return *outstruct, err + +} + +// GetVerifiedWarpBlockHash is a free data retrieval call binding the contract method 0xce7f5929. +// +// Solidity: function getVerifiedWarpBlockHash(uint32 index) view returns((bytes32,bytes32) warpBlockHash, bool valid) +func (_WarpTest *WarpTestSession) GetVerifiedWarpBlockHash(index uint32) (struct { + WarpBlockHash WarpBlockHash + Valid bool +}, error) { + return _WarpTest.Contract.GetVerifiedWarpBlockHash(&_WarpTest.CallOpts, index) +} + +// GetVerifiedWarpBlockHash is a free data retrieval call binding the contract method 0xce7f5929. +// +// Solidity: function getVerifiedWarpBlockHash(uint32 index) view returns((bytes32,bytes32) warpBlockHash, bool valid) +func (_WarpTest *WarpTestCallerSession) GetVerifiedWarpBlockHash(index uint32) (struct { + WarpBlockHash WarpBlockHash + Valid bool +}, error) { + return _WarpTest.Contract.GetVerifiedWarpBlockHash(&_WarpTest.CallOpts, index) +} + +// GetVerifiedWarpMessage is a free data retrieval call binding the contract method 0x6f825350. +// +// Solidity: function getVerifiedWarpMessage(uint32 index) view returns((bytes32,address,bytes) message, bool valid) +func (_WarpTest *WarpTestCaller) GetVerifiedWarpMessage(opts *bind.CallOpts, index uint32) (struct { + Message WarpMessage + Valid bool +}, error) { + var out []interface{} + err := _WarpTest.contract.Call(opts, &out, "getVerifiedWarpMessage", index) + + outstruct := new(struct { + Message WarpMessage + Valid bool + }) + if err != nil { + return *outstruct, err + } + + outstruct.Message = *abi.ConvertType(out[0], new(WarpMessage)).(*WarpMessage) + outstruct.Valid = *abi.ConvertType(out[1], new(bool)).(*bool) + + return *outstruct, err + +} + +// GetVerifiedWarpMessage is a free data retrieval call binding the contract method 0x6f825350. +// +// Solidity: function getVerifiedWarpMessage(uint32 index) view returns((bytes32,address,bytes) message, bool valid) +func (_WarpTest *WarpTestSession) GetVerifiedWarpMessage(index uint32) (struct { + Message WarpMessage + Valid bool +}, error) { + return _WarpTest.Contract.GetVerifiedWarpMessage(&_WarpTest.CallOpts, index) +} + +// GetVerifiedWarpMessage is a free data retrieval call binding the contract method 0x6f825350. +// +// Solidity: function getVerifiedWarpMessage(uint32 index) view returns((bytes32,address,bytes) message, bool valid) +func (_WarpTest *WarpTestCallerSession) GetVerifiedWarpMessage(index uint32) (struct { + Message WarpMessage + Valid bool +}, error) { + return _WarpTest.Contract.GetVerifiedWarpMessage(&_WarpTest.CallOpts, index) +} + +// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. +// +// Solidity: function sendWarpMessage(bytes payload) returns(bytes32 messageID) +func (_WarpTest *WarpTestTransactor) SendWarpMessage(opts *bind.TransactOpts, payload []byte) (*types.Transaction, error) { + return _WarpTest.contract.Transact(opts, "sendWarpMessage", payload) +} + +// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. +// +// Solidity: function sendWarpMessage(bytes payload) returns(bytes32 messageID) +func (_WarpTest *WarpTestSession) SendWarpMessage(payload []byte) (*types.Transaction, error) { + return _WarpTest.Contract.SendWarpMessage(&_WarpTest.TransactOpts, payload) +} + +// SendWarpMessage is a paid mutator transaction binding the contract method 0xee5b48eb. +// +// Solidity: function sendWarpMessage(bytes payload) returns(bytes32 messageID) +func (_WarpTest *WarpTestTransactorSession) SendWarpMessage(payload []byte) (*types.Transaction, error) { + return _WarpTest.Contract.SendWarpMessage(&_WarpTest.TransactOpts, payload) +} diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index c03e9ce4c1..0bc12bd1ef 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -37,12 +37,14 @@ import ( "github.com/ava-labs/subnet-evm/ethclient" "github.com/ava-labs/subnet-evm/params" "github.com/ava-labs/subnet-evm/precompile/contracts/warp" + "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warpbindings" "github.com/ava-labs/subnet-evm/tests" "github.com/ava-labs/subnet-evm/tests/utils" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" + warpPayload "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" ethereum "github.com/ava-labs/libevm" - warpbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" + warptestbindings "github.com/ava-labs/subnet-evm/precompile/contracts/warp/warptest/bindings" warpBackend "github.com/ava-labs/subnet-evm/warp" ginkgo "github.com/onsi/ginkgo/v2" ) @@ -634,35 +636,84 @@ func (w *warpTest) warpBindingsTest() { client := w.sendingSubnetClients[0] - log.Info("Verifying warp message fields", - "messageID", w.addressedCallUnsignedMessage.ID(), - "sourceChainID", w.addressedCallUnsignedMessage.SourceChainID, + log.Info("Deploying WarpTest proxy contract") + auth, err := bind.NewKeyedTransactorWithChainID(w.sendingSubnetFundedKey, w.sendingSubnetChainID) + require.NoError(err) + auth.Context = ctx + + proxyAddr, deployTx, warpTestContract, err := warptestbindings.DeployWarpTest(auth, client, warp.Module.Address) + require.NoError(err) + + log.Info("Waiting for WarpTest deployment", "txHash", deployTx.Hash(), "proxyAddr", proxyAddr) + deployReceipt, err := bind.WaitMined(ctx, client, deployTx) + require.NoError(err) + require.Equal(types.ReceiptStatusSuccessful, deployReceipt.Status) + + log.Info("Calling getBlockchainID via proxy contract") + returnedBlockchainID, err := warpTestContract.GetBlockchainID(&bind.CallOpts{Context: ctx}) + require.NoError(err) + require.Equal(w.sendingSubnet.BlockchainID, ids.ID(returnedBlockchainID)) + log.Info("getBlockchainID returned correct value", "blockchainID", ids.ID(returnedBlockchainID)) + + log.Info("Sending warp message via proxy contract", "payload", common.Bytes2Hex(testPayload)) + + startBlock, err := client.BlockNumber(ctx) + require.NoError(err) + + sendTx, err := warpTestContract.SendWarpMessage(auth, testPayload) + require.NoError(err) + + log.Info("Waiting for sendWarpMessage transaction", "txHash", sendTx.Hash()) + sendReceipt, err := bind.WaitMined(ctx, client, sendTx) + require.NoError(err) + require.Equal(types.ReceiptStatusSuccessful, sendReceipt.Status) + + log.Info("Filtering SendWarpMessage events using binding") + warpFilterer, err := warpbindings.NewIWarpMessengerFilterer(warp.Module.Address, client) + require.NoError(err) + + // The event sender is the proxy contract , since the proxy calls the precompile + endBlock := sendReceipt.BlockNumber.Uint64() + iter, err := warpFilterer.FilterSendWarpMessage( + &bind.FilterOpts{ + Start: startBlock, + End: &endBlock, + Context: ctx, + }, + []common.Address{proxyAddr}, // sender filter: the proxy contract + nil, // messageID filter: any ) + require.NoError(err) + defer iter.Close() + + // Verify we got exactly one event with the correct data + require.True(iter.Next(), "expected at least one SendWarpMessage event") + event := iter.Event // event is *IWarpMessengerSendWarpMessage - require.Equal( - w.sendingSubnet.BlockchainID, - w.addressedCallUnsignedMessage.SourceChainID, - "source chain ID mismatch in unsigned message", + log.Info("Received SendWarpMessage event", + "sender", event.Sender.Hex(), + "messageID", common.Bytes2Hex(event.MessageID[:]), ) - log.Info("Calling getBlockchainID on warp precompile using bindings") - warpCaller, err := warpbindings.NewIWarpMessengerCaller(warp.Module.Address, client) + // Verify event fields + require.Equal(proxyAddr, event.Sender, "event sender should be proxy contract") + + // The event.Message contains the full unsigned warp message bytes + unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(event.Message) require.NoError(err) - returnedBlockchainID, err := warpCaller.GetBlockchainID(&bind.CallOpts{Context: ctx}) + addressedCall, err := warpPayload.ParseAddressedCall(unsignedMsg.Payload) require.NoError(err) - log.Info("getBlockchainID returned", "blockchainID", ids.ID(returnedBlockchainID)) - require.Equal( - w.sendingSubnet.BlockchainID, - ids.ID(returnedBlockchainID), - "getBlockchainID returned unexpected value", - ) + require.Equal(testPayload, addressedCall.Payload, "payload mismatch in warp message") + require.Equal(proxyAddr.Bytes(), addressedCall.SourceAddress, "source address should be proxy contract") + + require.False(iter.Next(), "expected exactly one SendWarpMessage event") + require.NoError(iter.Error()) - log.Info("Warp message and blockchain ID verification complete", - "senderAddress", crypto.PubkeyToAddress(w.sendingSubnetFundedKey.PublicKey).Hex(), - "sourceChainID", "0x"+w.sendingSubnet.BlockchainID.Hex(), - "payload", "0x"+common.Bytes2Hex(testPayload), + log.Info("warp bindings test complete", + "proxyAddr", proxyAddr.Hex(), + "blockchainID", ids.ID(returnedBlockchainID), ) } From bf3ad0f6d04b13ac702b418a9368ccada319bc48 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 14:57:20 -0500 Subject: [PATCH 54/73] test: extract using bindings --- tests/warp/warp_test.go | 87 ++++++++++++----------------------------- 1 file changed, 25 insertions(+), 62 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 0bc12bd1ef..2085fa84c4 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -363,22 +363,8 @@ func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Clien return blockHash, blockNumber } -// verifyAndExtractWarpMessage verifies the SendWarpMessage event using both raw client -// filtering and topic-filtered querying, then extracts the unsigned message. -// -// We use topic-filtered FilterLogs queries instead of the generated binding's -// FilterSendWarpMessage iterator because the binding's UnpackLog, -// `func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log) error` -// fails to decode the warp precompile's event data. The precompile uses WarpABI.PackEvent -// which produces valid ABI-encoded data, but the generated binding's decoder seemingly -// expects a different format, causing offset calculation errors like this: -// -// > abi: cannot marshal in to go slice: offset -// > 36566719137455486913336721525167888666359637725852346248021916651272 would go -// > over slice boundary -// -// So instead we use raw FilterLogs with topic filters to extract the event data. -// TODO(JonathanOppenheimer): is there a better way to do this? a workaround? +// verifyAndExtractWarpMessage filters for the SendWarpMessage event using the +// generated binding and extracts the unsigned warp message. func (w *warpTest) verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, @@ -387,62 +373,39 @@ func (w *warpTest) verifyAndExtractWarpMessage( ) *avalancheWarp.UnsignedMessage { require := require.New(ginkgo.GinkgoT()) - // Method 1: Raw client FilterLogs (by address only) - log.Info("Filtering SendWarpMessage events using raw client") - clientLogs, err := client.FilterLogs(ctx, ethereum.FilterQuery{ - BlockHash: &blockHash, - Addresses: []common.Address{warp.Module.Address}, - }) - require.NoError(err) - require.Len(clientLogs, 1) - - clientLog := clientLogs[0] - unsignedMsgFromClient, err := warp.UnpackSendWarpEventDataToMessage(clientLog.Data) + log.Info("Filtering SendWarpMessage events using binding") + warpFilterer, err := warpbindings.NewIWarpMessengerFilterer(warp.Module.Address, client) require.NoError(err) - // Method 2: Filter with indexed topic filters (event ID + sender) - // This replicates what the binding's FilterSendWarpMessage does internally, - // but without using the broken UnpackLog decoder. - log.Info("Filtering SendWarpMessage events using topic filters") - eventID := warp.WarpABI.Events["SendWarpMessage"].ID - senderTopic := common.BytesToHash(w.sendingSubnetFundedAddress.Bytes()) - - topicFilteredLogs, err := client.FilterLogs(ctx, ethereum.FilterQuery{ - FromBlock: big.NewInt(int64(blockNumber)), - ToBlock: big.NewInt(int64(blockNumber)), - Addresses: []common.Address{warp.Module.Address}, - Topics: [][]common.Hash{ - {eventID}, // Topic 0: Event signature - {senderTopic}, // Topic 1: Indexed sender - nil, // Topic 2: Any messageID + iter, err := warpFilterer.FilterSendWarpMessage( + &bind.FilterOpts{ + Start: blockNumber, + End: &blockNumber, + Context: ctx, }, - }) + []common.Address{w.sendingSubnetFundedAddress}, // sender filter + nil, // messageID filter: any + ) require.NoError(err) - require.Len(topicFilteredLogs, 1) + defer iter.Close() - topicLog := topicFilteredLogs[0] - unsignedMsgFromTopicFilter, err := warp.UnpackSendWarpEventDataToMessage(topicLog.Data) - require.NoError(err) + require.True(iter.Next(), "expected SendWarpMessage event") + event := iter.Event - // Verify both methods return the same event - require.Equal(clientLog.TxHash, topicLog.TxHash, "transaction hash mismatch") - require.Equal(clientLog.Data, topicLog.Data, "log data mismatch") + log.Info("Found SendWarpMessage event", + "sender", event.Sender.Hex(), + "messageID", common.Bytes2Hex(event.MessageID[:]), + ) - // Verify both produce the same unsigned message - require.Equal(unsignedMsgFromClient.Bytes(), unsignedMsgFromTopicFilter.Bytes(), - "raw and topic-filtered queries should return the same unsigned message") + require.Equal(w.sendingSubnetFundedAddress, event.Sender) - // Verify event topics - require.Len(clientLog.Topics, 3, "SendWarpMessage should have 3 topics") - require.Equal(eventID, clientLog.Topics[0], "event ID mismatch") - require.Equal(senderTopic, clientLog.Topics[1], "sender topic mismatch") + unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(event.Message) + require.NoError(err) - log.Info("Found SendWarpMessage event via both methods", - "sender", w.sendingSubnetFundedAddress.Hex(), - "messageID", clientLog.Topics[2].Hex(), - ) + require.False(iter.Next(), "expected exactly one SendWarpMessage event") + require.NoError(iter.Error()) - return unsignedMsgFromTopicFilter + return unsignedMsg } func (w *warpTest) aggregateSignaturesViaAPI() { From 66ae1e8c29f6debf21436fea383edc381f06b98f Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 15:00:42 -0500 Subject: [PATCH 55/73] style: set addressedCallUnsignedMessage directly --- tests/warp/warp_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 2085fa84c4..3541d967e6 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -298,7 +298,7 @@ func (w *warpTest) sendMessageFromSendingSubnet() { blockHash, blockNumber := w.sendWarpMessageTx(ctx, client) w.blockID = ids.ID(blockHash) - w.addressedCallUnsignedMessage = w.verifyAndExtractWarpMessage(ctx, client, blockHash, blockNumber) + w.verifyAndExtractWarpMessage(ctx, client, blockHash, blockNumber) log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", w.addressedCallUnsignedMessage.ID(), "unsignedWarpMessage", w.addressedCallUnsignedMessage, @@ -364,13 +364,13 @@ func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Clien } // verifyAndExtractWarpMessage filters for the SendWarpMessage event using the -// generated binding and extracts the unsigned warp message. +// generated binding and sets w.addressedCallUnsignedMessage. func (w *warpTest) verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, blockHash common.Hash, blockNumber uint64, -) *avalancheWarp.UnsignedMessage { +) { require := require.New(ginkgo.GinkgoT()) log.Info("Filtering SendWarpMessage events using binding") @@ -399,13 +399,11 @@ func (w *warpTest) verifyAndExtractWarpMessage( require.Equal(w.sendingSubnetFundedAddress, event.Sender) - unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(event.Message) + w.addressedCallUnsignedMessage, err = avalancheWarp.ParseUnsignedMessage(event.Message) require.NoError(err) require.False(iter.Next(), "expected exactly one SendWarpMessage event") require.NoError(iter.Error()) - - return unsignedMsg } func (w *warpTest) aggregateSignaturesViaAPI() { From 2b2e3ffcc8c7e340160d36657f605ffdf67651e3 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 15:01:51 -0500 Subject: [PATCH 56/73] chore: lint --- tests/warp/warp_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 3541d967e6..a164ba9bd8 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -298,7 +298,7 @@ func (w *warpTest) sendMessageFromSendingSubnet() { blockHash, blockNumber := w.sendWarpMessageTx(ctx, client) w.blockID = ids.ID(blockHash) - w.verifyAndExtractWarpMessage(ctx, client, blockHash, blockNumber) + w.verifyAndExtractWarpMessage(ctx, client, blockNumber) log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", w.addressedCallUnsignedMessage.ID(), "unsignedWarpMessage", w.addressedCallUnsignedMessage, @@ -368,7 +368,6 @@ func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Clien func (w *warpTest) verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, - blockHash common.Hash, blockNumber uint64, ) { require := require.New(ginkgo.GinkgoT()) From ad6f6b9e97a70b08b02482649a86384de87d3822 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 15:18:02 -0500 Subject: [PATCH 57/73] chore: reduce diff --- tests/precompile/genesis/warp.json | 84 +++++++++++++++--------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/tests/precompile/genesis/warp.json b/tests/precompile/genesis/warp.json index ab59d8a10e..115bcb16f3 100644 --- a/tests/precompile/genesis/warp.json +++ b/tests/precompile/genesis/warp.json @@ -1,45 +1,45 @@ { - "config": { - "chainId": 99999, - "homesteadBlock": 0, - "eip150Block": 0, - "eip155Block": 0, - "eip158Block": 0, - "byzantiumBlock": 0, - "constantinopleBlock": 0, - "petersburgBlock": 0, - "istanbulBlock": 0, - "muirGlacierBlock": 0, - "feeConfig": { - "gasLimit": 20000000, - "minBaseFee": 1000000000, - "targetGas": 100000000, - "baseFeeChangeDenominator": 48, - "minBlockGasCost": 0, - "maxBlockGasCost": 10000000, - "targetBlockRate": 2, - "blockGasCostStep": 500000 - }, - "warpConfig": { - "blockTimestamp": 1607144400 - } + "config": { + "chainId": 99999, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "muirGlacierBlock": 0, + "feeConfig": { + "gasLimit": 20000000, + "minBaseFee": 1000000000, + "targetGas": 100000000, + "baseFeeChangeDenominator": 48, + "minBlockGasCost": 0, + "maxBlockGasCost": 10000000, + "targetBlockRate": 2, + "blockGasCostStep": 500000 }, - "alloc": { - "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { - "balance": "0x52B7D2DCC80CD2E4000000" - }, - "0x0Fa8EA536Be85F32724D57A37758761B86416123": { - "balance": "0x52B7D2DCC80CD2E4000000" - } + "warpConfig": { + "blockTimestamp": 1607144400 + } + }, + "alloc": { + "8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC": { + "balance": "0x52B7D2DCC80CD2E4000000" }, - "nonce": "0x0", - "timestamp": "0x5FCB13D0", - "extraData": "0x00", - "gasLimit": "0x1312D00", - "difficulty": "0x0", - "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", - "number": "0x0", - "gasUsed": "0x0", - "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" - } \ No newline at end of file + "0x0Fa8EA536Be85F32724D57A37758761B86416123": { + "balance": "0x52B7D2DCC80CD2E4000000" + } + }, + "nonce": "0x0", + "timestamp": "0x5FCB13D0", + "extraData": "0x00", + "gasLimit": "0x1312D00", + "difficulty": "0x0", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "number": "0x0", + "gasUsed": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" +} \ No newline at end of file From b11a074c9d1a68ab3185357c080ce55b6d6d2ff1 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 15:18:51 -0500 Subject: [PATCH 58/73] style: add back blank line --- tests/precompile/genesis/warp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/precompile/genesis/warp.json b/tests/precompile/genesis/warp.json index 115bcb16f3..e4c17d05f0 100644 --- a/tests/precompile/genesis/warp.json +++ b/tests/precompile/genesis/warp.json @@ -42,4 +42,4 @@ "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" -} \ No newline at end of file +} From d2c770410f24165f0ded800712c85af26b4dac38 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 16:42:20 -0500 Subject: [PATCH 59/73] chore: move ExampleWarp.sol to where it is used --- plugin/evm/ExampleWarp.sol | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugin/evm/ExampleWarp.sol diff --git a/plugin/evm/ExampleWarp.sol b/plugin/evm/ExampleWarp.sol new file mode 100644 index 0000000000..711642f77a --- /dev/null +++ b/plugin/evm/ExampleWarp.sol @@ -0,0 +1,58 @@ +//SPDX-License-Identifier: MIT +pragma solidity ^0.8.24; +pragma experimental ABIEncoderV2; + +import "precompile/contracts/warp/warpbindings/IWarpMessenger.sol"; + +contract ExampleWarp { + address constant WARP_ADDRESS = 0x0200000000000000000000000000000000000005; + IWarpMessenger warp = IWarpMessenger(WARP_ADDRESS); + + // sendWarpMessage sends a warp message containing the payload + function sendWarpMessage(bytes calldata payload) external { + warp.sendWarpMessage(payload); + } + + // validateWarpMessage retrieves the warp message attached to the transaction and verifies all of its attributes. + function validateWarpMessage( + uint32 index, + bytes32 sourceChainID, + address originSenderAddress, + bytes calldata payload + ) external view { + (WarpMessage memory message, bool valid) = warp.getVerifiedWarpMessage(index); + require(valid); + require(message.sourceChainID == sourceChainID); + require(message.originSenderAddress == originSenderAddress); + require(keccak256(message.payload) == keccak256(payload)); + } + + function validateInvalidWarpMessage(uint32 index) external view { + (WarpMessage memory message, bool valid) = warp.getVerifiedWarpMessage(index); + require(!valid); + require(message.sourceChainID == bytes32(0)); + require(message.originSenderAddress == address(0)); + require(keccak256(message.payload) == keccak256(bytes(""))); + } + + // validateWarpBlockHash retrieves the warp block hash attached to the transaction and verifies it matches the + // expected block hash. + function validateWarpBlockHash(uint32 index, bytes32 sourceChainID, bytes32 blockHash) external view { + (WarpBlockHash memory warpBlockHash, bool valid) = warp.getVerifiedWarpBlockHash(index); + require(valid); + require(warpBlockHash.sourceChainID == sourceChainID); + require(warpBlockHash.blockHash == blockHash); + } + + function validateInvalidWarpBlockHash(uint32 index) external view { + (WarpBlockHash memory warpBlockHash, bool valid) = warp.getVerifiedWarpBlockHash(index); + require(!valid); + require(warpBlockHash.sourceChainID == bytes32(0)); + require(warpBlockHash.blockHash == bytes32(0)); + } + + // validateGetBlockchainID checks that the blockchainID returned by warp matches the argument + function validateGetBlockchainID(bytes32 blockchainID) external view { + require(blockchainID == warp.getBlockchainID()); + } +} \ No newline at end of file From f8af497039160da1008e4fa3376d1776a36b30c6 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Mon, 8 Dec 2025 16:42:47 -0500 Subject: [PATCH 60/73] style: restore blank line --- plugin/evm/ExampleWarp.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/evm/ExampleWarp.sol b/plugin/evm/ExampleWarp.sol index 711642f77a..1e7a44867d 100644 --- a/plugin/evm/ExampleWarp.sol +++ b/plugin/evm/ExampleWarp.sol @@ -55,4 +55,4 @@ contract ExampleWarp { function validateGetBlockchainID(bytes32 blockchainID) external view { require(blockchainID == warp.getBlockchainID()); } -} \ No newline at end of file +} From 86ce37b50dc5be5633561f43a02eb20813baecc7 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 11:32:54 -0500 Subject: [PATCH 61/73] test: reuse verifyAndExtractWarpMessage helper --- tests/warp/warp_test.go | 48 ++++++----------------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index a164ba9bd8..27c8115192 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -388,8 +388,9 @@ func (w *warpTest) verifyAndExtractWarpMessage( require.NoError(err) defer iter.Close() - require.True(iter.Next(), "expected SendWarpMessage event") - event := iter.Event + // Verify we got exactly one event with the correct data + require.True(iter.Next(), "expected at least one SendWarpMessage event") + event := iter.Event // event is *IWarpMessengerSendWarpMessage log.Info("Found SendWarpMessage event", "sender", event.Sender.Hex(), @@ -398,6 +399,7 @@ func (w *warpTest) verifyAndExtractWarpMessage( require.Equal(w.sendingSubnetFundedAddress, event.Sender) + // The event.Message contains the full unsigned warp message bytes w.addressedCallUnsignedMessage, err = avalancheWarp.ParseUnsignedMessage(event.Message) require.NoError(err) @@ -617,9 +619,6 @@ func (w *warpTest) warpBindingsTest() { log.Info("Sending warp message via proxy contract", "payload", common.Bytes2Hex(testPayload)) - startBlock, err := client.BlockNumber(ctx) - require.NoError(err) - sendTx, err := warpTestContract.SendWarpMessage(auth, testPayload) require.NoError(err) @@ -628,49 +627,14 @@ func (w *warpTest) warpBindingsTest() { require.NoError(err) require.Equal(types.ReceiptStatusSuccessful, sendReceipt.Status) - log.Info("Filtering SendWarpMessage events using binding") - warpFilterer, err := warpbindings.NewIWarpMessengerFilterer(warp.Module.Address, client) - require.NoError(err) - - // The event sender is the proxy contract , since the proxy calls the precompile - endBlock := sendReceipt.BlockNumber.Uint64() - iter, err := warpFilterer.FilterSendWarpMessage( - &bind.FilterOpts{ - Start: startBlock, - End: &endBlock, - Context: ctx, - }, - []common.Address{proxyAddr}, // sender filter: the proxy contract - nil, // messageID filter: any - ) - require.NoError(err) - defer iter.Close() - - // Verify we got exactly one event with the correct data - require.True(iter.Next(), "expected at least one SendWarpMessage event") - event := iter.Event // event is *IWarpMessengerSendWarpMessage - - log.Info("Received SendWarpMessage event", - "sender", event.Sender.Hex(), - "messageID", common.Bytes2Hex(event.MessageID[:]), - ) - - // Verify event fields - require.Equal(proxyAddr, event.Sender, "event sender should be proxy contract") - - // The event.Message contains the full unsigned warp message bytes - unsignedMsg, err := avalancheWarp.ParseUnsignedMessage(event.Message) - require.NoError(err) + w.verifyAndExtractWarpMessage(ctx, client, sendReceipt.BlockNumber.Uint64()) - addressedCall, err := warpPayload.ParseAddressedCall(unsignedMsg.Payload) + addressedCall, err := warpPayload.ParseAddressedCall(w.addressedCallUnsignedMessage.Payload) require.NoError(err) require.Equal(testPayload, addressedCall.Payload, "payload mismatch in warp message") require.Equal(proxyAddr.Bytes(), addressedCall.SourceAddress, "source address should be proxy contract") - require.False(iter.Next(), "expected exactly one SendWarpMessage event") - require.NoError(iter.Error()) - log.Info("warp bindings test complete", "proxyAddr", proxyAddr.Hex(), "blockchainID", ids.ID(returnedBlockchainID), From c2e0eb7da617b059125786188b09f71640181a58 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 11:46:44 -0500 Subject: [PATCH 62/73] test: specify sender --- tests/warp/warp_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 27c8115192..41d9fad03c 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -298,7 +298,7 @@ func (w *warpTest) sendMessageFromSendingSubnet() { blockHash, blockNumber := w.sendWarpMessageTx(ctx, client) w.blockID = ids.ID(blockHash) - w.verifyAndExtractWarpMessage(ctx, client, blockNumber) + w.verifyAndExtractWarpMessage(ctx, client, blockNumber, w.sendingSubnetFundedAddress) log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", w.addressedCallUnsignedMessage.ID(), "unsignedWarpMessage", w.addressedCallUnsignedMessage, @@ -369,6 +369,7 @@ func (w *warpTest) verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, blockNumber uint64, + sender common.Address, ) { require := require.New(ginkgo.GinkgoT()) @@ -382,7 +383,7 @@ func (w *warpTest) verifyAndExtractWarpMessage( End: &blockNumber, Context: ctx, }, - []common.Address{w.sendingSubnetFundedAddress}, // sender filter + []common.Address{sender}, nil, // messageID filter: any ) require.NoError(err) @@ -397,7 +398,7 @@ func (w *warpTest) verifyAndExtractWarpMessage( "messageID", common.Bytes2Hex(event.MessageID[:]), ) - require.Equal(w.sendingSubnetFundedAddress, event.Sender) + require.Equal(sender, event.Sender) // The event.Message contains the full unsigned warp message bytes w.addressedCallUnsignedMessage, err = avalancheWarp.ParseUnsignedMessage(event.Message) @@ -627,7 +628,7 @@ func (w *warpTest) warpBindingsTest() { require.NoError(err) require.Equal(types.ReceiptStatusSuccessful, sendReceipt.Status) - w.verifyAndExtractWarpMessage(ctx, client, sendReceipt.BlockNumber.Uint64()) + w.verifyAndExtractWarpMessage(ctx, client, sendReceipt.BlockNumber.Uint64(), proxyAddr) addressedCall, err := warpPayload.ParseAddressedCall(w.addressedCallUnsignedMessage.Payload) require.NoError(err) From 5e78e94a76f95a11a0a60056f3b2ea2b3af3fdf2 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 14:01:35 -0500 Subject: [PATCH 63/73] Update tests/warp/warp_test.go Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com> Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- tests/warp/warp_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 41d9fad03c..40c73656a4 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -390,7 +390,7 @@ func (w *warpTest) verifyAndExtractWarpMessage( defer iter.Close() // Verify we got exactly one event with the correct data - require.True(iter.Next(), "expected at least one SendWarpMessage event") + require.True(iter.Next(), "expected a SendWarpMessage event") event := iter.Event // event is *IWarpMessengerSendWarpMessage log.Info("Found SendWarpMessage event", From 9016376e5243a388da14fddfe96904457ba609a0 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 14:02:09 -0500 Subject: [PATCH 64/73] Update tests/warp/warp_test.go Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com> Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- tests/warp/warp_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 40c73656a4..f5ec66da1c 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -391,7 +391,7 @@ func (w *warpTest) verifyAndExtractWarpMessage( // Verify we got exactly one event with the correct data require.True(iter.Next(), "expected a SendWarpMessage event") - event := iter.Event // event is *IWarpMessengerSendWarpMessage + event := iter.Event log.Info("Found SendWarpMessage event", "sender", event.Sender.Hex(), From dfec9d9c70b6c0d5816b7cd51ff3c01f9a07476e Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 14:06:04 -0500 Subject: [PATCH 65/73] Update tests/warp/warp_test.go Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com> Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- tests/warp/warp_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index f5ec66da1c..685e031097 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -389,7 +389,6 @@ func (w *warpTest) verifyAndExtractWarpMessage( require.NoError(err) defer iter.Close() - // Verify we got exactly one event with the correct data require.True(iter.Next(), "expected a SendWarpMessage event") event := iter.Event From e16d112d80ea34c1e96c821e99c5e66592577817 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 14:06:33 -0500 Subject: [PATCH 66/73] docs: expand verifyAndExtractWarpMessage function comment --- tests/warp/warp_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 685e031097..ef8d8f5cdd 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -363,8 +363,11 @@ func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Clien return blockHash, blockNumber } -// verifyAndExtractWarpMessage filters for the SendWarpMessage event using the -// generated binding and sets w.addressedCallUnsignedMessage. +// verifyAndExtractWarpMessage queries the given block for SendWarpMessage events +// emitted by the specified sender using the IWarpMessengerFilterer binding. It +// asserts that exactly one such event exists and then parses the unsigned warp +// message from the event. The unsigned warp message is stored in +// w.addressedCallUnsignedMessage for use in subsequent test steps. func (w *warpTest) verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, From e0f95323e0e630d491b7067c494c350d6bb9220a Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 14:06:42 -0500 Subject: [PATCH 67/73] Update tests/warp/warp_test.go Co-authored-by: Austin Larson <78000745+alarso16@users.noreply.github.com> Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- tests/warp/warp_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index ef8d8f5cdd..68d751133b 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -402,7 +402,6 @@ func (w *warpTest) verifyAndExtractWarpMessage( require.Equal(sender, event.Sender) - // The event.Message contains the full unsigned warp message bytes w.addressedCallUnsignedMessage, err = avalancheWarp.ParseUnsignedMessage(event.Message) require.NoError(err) From 12d27a8e5585250ceff740b550248aa39bd5ed8d Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Tue, 9 Dec 2025 14:08:04 -0500 Subject: [PATCH 68/73] chore: regenerate bindings --- .../allowlisttest/bindings/gen_allowlisttest_binding.go | 2 +- .../feemanagertest/bindings/gen_feemanagertest_binding.go | 2 +- .../nativemintertest/bindings/gen_nativemintertest_binding.go | 2 +- .../rewardmanagertest/bindings/gen_rewardmanagertest_binding.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go index 1d487801d7..03db18e3d4 100644 --- a/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go +++ b/precompile/allowlist/allowlisttest/bindings/gen_allowlisttest_binding.go @@ -32,7 +32,7 @@ var ( // AllowListTestMetaData contains all meta data concerning the AllowListTest contract. var AllowListTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"precompileAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"deployContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"readAllowList\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"revoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setEnabled\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setNone\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610b4b380380610b4b833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610a3f8061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c80638c6bfb3b116100645780638c6bfb3b1461012e5780639015d3711461014a578063d0ebdbe71461017a578063eb54dae114610196578063f3ae2415146101c65761009c565b80630aaf7043146100a057806324d7806c146100bc5780636cd5c39b146100ec578063704b6c02146100f657806374a8f10314610112575b5f5ffd5b6100ba60048036038101906100b5919061082d565b6101f6565b005b6100d660048036038101906100d1919061082d565b61027f565b6040516100e39190610872565b60405180910390f35b6100f4610322565b005b610110600480360381019061010b919061082d565b61034b565b005b61012c6004803603810190610127919061082d565b6103d4565b005b6101486004803603810190610143919061082d565b6104cb565b005b610164600480360381019061015f919061082d565b610554565b6040516101719190610872565b60405180910390f35b610194600480360381019061018f919061082d565b6105f7565b005b6101b060048036038101906101ab919061082d565b610680565b6040516101bd91906108a3565b60405180910390f35b6101e060048036038101906101db919061082d565b610720565b6040516101ed9190610872565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161024f91906108cb565b5f604051808303815f87803b158015610266575f5ffd5b505af1158015610278573d5f5f3e3d5ffd5b5050505050565b5f60025f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102db91906108cb565b602060405180830381865afa1580156102f6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031a919061090e565b149050919050565b60405161032e906107c3565b604051809103905ff080158015610347573d5f5f3e3d5ffd5b5050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016103a491906108cb565b5f604051808303815f87803b1580156103bb575f5ffd5b505af11580156103cd573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043990610993565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161049b91906108cb565b5f604051808303815f87803b1580156104b2575f5ffd5b505af11580156104c4573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161052491906108cb565b5f604051808303815f87803b15801561053b575f5ffd5b505af115801561054d573d5f5f3e3d5ffd5b5050505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016105af91906108cb565b602060405180830381865afa1580156105ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ee919061090e565b14159050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b815260040161065091906108cb565b5f604051808303815f87803b158015610667575f5ffd5b505af1158015610679573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1836040518263ffffffff1660e01b81526004016106da91906108cb565b602060405180830381865afa1580156106f5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610719919061090e565b9050919050565b5f60035f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161077c91906108cb565b602060405180830381865afa158015610797573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb919061090e565b149050919050565b6058806109b283390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107fc826107d3565b9050919050565b61080c816107f2565b8114610816575f5ffd5b50565b5f8135905061082781610803565b92915050565b5f60208284031215610842576108416107cf565b5b5f61084f84828501610819565b91505092915050565b5f8115159050919050565b61086c81610858565b82525050565b5f6020820190506108855f830184610863565b92915050565b5f819050919050565b61089d8161088b565b82525050565b5f6020820190506108b65f830184610894565b92915050565b6108c5816107f2565b82525050565b5f6020820190506108de5f8301846108bc565b92915050565b6108ed8161088b565b81146108f7575f5ffd5b50565b5f81519050610908816108e4565b92915050565b5f60208284031215610923576109226107cf565b5b5f610930848285016108fa565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f61097d601683610939565b915061098882610949565b602082019050919050565b5f6020820190508181035f8301526109aa81610971565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea26469706673582212208a5bc8a7b93e2c0f0a241672431e82f50bbb4139ff697657704bf0aee79f627e64736f6c634300081e0033a26469706673582212202b59ccfa68fda71ece325df8f6a5a8c3c714b63c0c499cdfb6816b50adf71a1164736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610b4b380380610b4b833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610a3f8061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009c575f3560e01c80638c6bfb3b116100645780638c6bfb3b1461012e5780639015d3711461014a578063d0ebdbe71461017a578063eb54dae114610196578063f3ae2415146101c65761009c565b80630aaf7043146100a057806324d7806c146100bc5780636cd5c39b146100ec578063704b6c02146100f657806374a8f10314610112575b5f5ffd5b6100ba60048036038101906100b5919061082d565b6101f6565b005b6100d660048036038101906100d1919061082d565b61027f565b6040516100e39190610872565b60405180910390f35b6100f4610322565b005b610110600480360381019061010b919061082d565b61034b565b005b61012c6004803603810190610127919061082d565b6103d4565b005b6101486004803603810190610143919061082d565b6104cb565b005b610164600480360381019061015f919061082d565b610554565b6040516101719190610872565b60405180910390f35b610194600480360381019061018f919061082d565b6105f7565b005b6101b060048036038101906101ab919061082d565b610680565b6040516101bd91906108a3565b60405180910390f35b6101e060048036038101906101db919061082d565b610720565b6040516101ed9190610872565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630aaf7043826040518263ffffffff1660e01b815260040161024f91906108cb565b5f604051808303815f87803b158015610266575f5ffd5b505af1158015610278573d5f5f3e3d5ffd5b5050505050565b5f60025f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016102db91906108cb565b602060405180830381865afa1580156102f6573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031a919061090e565b149050919050565b60405161032e906107c3565b604051809103905ff080158015610347573d5f5f3e3d5ffd5b5050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663704b6c02826040518263ffffffff1660e01b81526004016103a491906108cb565b5f604051808303815f87803b1580156103bb575f5ffd5b505af11580156103cd573d5f5f3e3d5ffd5b5050505050565b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1603610442576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043990610993565b60405180910390fd5b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161049b91906108cb565b5f604051808303815f87803b1580156104b2575f5ffd5b505af11580156104c4573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c6bfb3b826040518263ffffffff1660e01b815260040161052491906108cb565b5f604051808303815f87803b15801561053b575f5ffd5b505af115801561054d573d5f5f3e3d5ffd5b5050505050565b5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b81526004016105af91906108cb565b602060405180830381865afa1580156105ca573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ee919061090e565b14159050919050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0ebdbe7826040518263ffffffff1660e01b815260040161065091906108cb565b5f604051808303815f87803b158015610667575f5ffd5b505af1158015610679573d5f5f3e3d5ffd5b5050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1836040518263ffffffff1660e01b81526004016106da91906108cb565b602060405180830381865afa1580156106f5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610719919061090e565b9050919050565b5f60035f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb54dae1846040518263ffffffff1660e01b815260040161077c91906108cb565b602060405180830381865afa158015610797573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107bb919061090e565b149050919050565b6058806109b283390190565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107fc826107d3565b9050919050565b61080c816107f2565b8114610816575f5ffd5b50565b5f8135905061082781610803565b92915050565b5f60208284031215610842576108416107cf565b5b5f61084f84828501610819565b91505092915050565b5f8115159050919050565b61086c81610858565b82525050565b5f6020820190506108855f830184610863565b92915050565b5f819050919050565b61089d8161088b565b82525050565b5f6020820190506108b65f830184610894565b92915050565b6108c5816107f2565b82525050565b5f6020820190506108de5f8301846108bc565b92915050565b6108ed8161088b565b81146108f7575f5ffd5b50565b5f81519050610908816108e4565b92915050565b5f60208284031215610923576109226107cf565b5b5f610930848285016108fa565b91505092915050565b5f82825260208201905092915050565b7f63616e6e6f74207265766f6b65206f776e20726f6c65000000000000000000005f82015250565b5f61097d601683610939565b915061098882610949565b602082019050919050565b5f6020820190508181035f8301526109aa81610971565b905091905056fe6080604052348015600e575f5ffd5b50603e80601a5f395ff3fe60806040525f5ffdfea2646970667358221220280b0c51a337cdf98d746d9c8ed316db6c18a84f720063878220cb6fa9d5ea6464736f6c634300081e0033a26469706673582212200dc8fedd92f2304306aa259642e205efcace5bb5b9cc8e715dd3ad698b81b89d64736f6c634300081e0033", } // AllowListTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go index 9ff78d07fb..26819e00ca 100644 --- a/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go +++ b/precompile/contracts/feemanager/feemanagertest/bindings/gen_feemanagertest_binding.go @@ -32,7 +32,7 @@ var ( // FeeManagerTestMetaData contains all meta data concerning the FeeManagerTest contract. var FeeManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"feeManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getFeeConfig\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFeeConfigLastChangedAt\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetBlockRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"targetGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"baseFeeChangeDenominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxBlockGasCost\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockGasCostStep\",\"type\":\"uint256\"}],\"name\":\"setFeeConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220f391e9a1d5d556a8d7226325f6fdfb686b065d38e58b1cb4edab2a6b9d4330c364736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610641380380610641833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105358061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c80635fbbc0d2146100435780638f10b586146100685780639e05549a14610084575b5f5ffd5b61004b6100a2565b60405161005f98979695949392919061029b565b60405180910390f35b610082600480360381019061007d9190610345565b610152565b005b61008c6101f0565b60405161009991906103f6565b60405180910390f35b5f5f5f5f5f5f5f5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635fbbc0d26040518163ffffffff1660e01b815260040161010060405180830381865afa158015610114573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101389190610423565b975097509750975097509750975097509091929394959697565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f10b58689898989898989896040518963ffffffff1660e01b81526004016101b998979695949392919061029b565b5f604051808303815f87803b1580156101d0575f5ffd5b505af11580156101e2573d5f5f3e3d5ffd5b505050505050505050505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639e05549a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561025a573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061027e91906104d4565b905090565b5f819050919050565b61029581610283565b82525050565b5f610100820190506102af5f83018b61028c565b6102bc602083018a61028c565b6102c9604083018961028c565b6102d6606083018861028c565b6102e3608083018761028c565b6102f060a083018661028c565b6102fd60c083018561028c565b61030a60e083018461028c565b9998505050505050505050565b5f5ffd5b61032481610283565b811461032e575f5ffd5b50565b5f8135905061033f8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b03121561036257610361610317565b5b5f61036f8b828c01610331565b98505060206103808b828c01610331565b97505060406103918b828c01610331565b96505060606103a28b828c01610331565b95505060806103b38b828c01610331565b94505060a06103c48b828c01610331565b93505060c06103d58b828c01610331565b92505060e06103e68b828c01610331565b9150509295985092959890939650565b5f6020820190506104095f83018461028c565b92915050565b5f8151905061041d8161031b565b92915050565b5f5f5f5f5f5f5f5f610100898b0312156104405761043f610317565b5b5f61044d8b828c0161040f565b985050602061045e8b828c0161040f565b975050604061046f8b828c0161040f565b96505060606104808b828c0161040f565b95505060806104918b828c0161040f565b94505060a06104a28b828c0161040f565b93505060c06104b38b828c0161040f565b92505060e06104c48b828c0161040f565b9150509295985092959890939650565b5f602082840312156104e9576104e8610317565b5b5f6104f68482850161040f565b9150509291505056fea2646970667358221220a0d30c6a71cc81448b07e31dbe50504462c614e508e6503e50177269ac96bf8664736f6c634300081e0033", } // FeeManagerTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go index e2b5775eb8..db0d4fbec2 100644 --- a/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go +++ b/precompile/contracts/nativeminter/nativemintertest/bindings/gen_nativemintertest_binding.go @@ -32,7 +32,7 @@ var ( // NativeMinterTestMetaData contains all meta data concerning the NativeMinterTest contract. var NativeMinterTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"nativeMinterPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintNativeCoin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea264697066735822122050e9d2c1d7f897401745e829bb1e0994daee122973eda0e3a665cadd5030259b64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610336380380610336833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b61022a8061010c5f395ff3fe608060405260043610610021575f3560e01c80634f5aaaba1461002c57610028565b3661002857005b5f5ffd5b348015610037575f5ffd5b50610052600480360381019061004d9190610171565b610054565b005b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634f5aaaba83836040518363ffffffff1660e01b81526004016100af9291906101cd565b5f604051808303815f87803b1580156100c6575f5ffd5b505af11580156100d8573d5f5f3e3d5ffd5b505050505050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010d826100e4565b9050919050565b61011d81610103565b8114610127575f5ffd5b50565b5f8135905061013881610114565b92915050565b5f819050919050565b6101508161013e565b811461015a575f5ffd5b50565b5f8135905061016b81610147565b92915050565b5f5f60408385031215610187576101866100e0565b5b5f6101948582860161012a565b92505060206101a58582860161015d565b9150509250929050565b6101b881610103565b82525050565b6101c78161013e565b82525050565b5f6040820190506101e05f8301856101af565b6101ed60208301846101be565b939250505056fea2646970667358221220aaf5c98d65a5777337a287c8bf1b051ecdf968b03991ec36ce1e434d6a46297264736f6c634300081e0033", } // NativeMinterTestABI is the input ABI used to generate the binding from. diff --git a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go index 023db5173a..082c32c9cf 100644 --- a/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go +++ b/precompile/contracts/rewardmanager/rewardmanagertest/bindings/gen_rewardmanagertest_binding.go @@ -32,7 +32,7 @@ var ( // RewardManagerTestMetaData contains all meta data concerning the RewardManagerTest contract. var RewardManagerTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"rewardManagerPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"allowFeeRecipients\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"areFeeRecipientsAllowed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentRewardAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableRewards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setRewardAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220ed22c586ee8598087f4eba32fd59beac21b373cf65a5fe8e0b95fae5833c719f64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610663380380610663833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b6105578061010c5f395ff3fe60806040526004361061004d575f3560e01c80630329099f146100585780635e00e6791461006e578063bc17862814610096578063e915608b146100ac578063f6542b2e146100d657610054565b3661005457005b5f5ffd5b348015610063575f5ffd5b5061006c610100565b005b348015610079575f5ffd5b50610094600480360381019061008f9190610407565b61017d565b005b3480156100a1575f5ffd5b506100aa610206565b005b3480156100b7575f5ffd5b506100c0610283565b6040516100cd9190610441565b60405180910390f35b3480156100e1575f5ffd5b506100ea610316565b6040516100f79190610474565b60405180910390f35b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16630329099f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610165575f5ffd5b505af1158015610177573d5f5f3e3d5ffd5b50505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e00e679826040518263ffffffff1660e01b81526004016101d69190610441565b5f604051808303815f87803b1580156101ed575f5ffd5b505af11580156101ff573d5f5f3e3d5ffd5b5050505050565b5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bc1786286040518163ffffffff1660e01b81526004015f604051808303815f87803b15801561026b575f5ffd5b505af115801561027d573d5f5f3e3d5ffd5b50505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e915608b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102ed573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061031191906104a1565b905090565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f6542b2e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610380573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a491906104f6565b905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103d6826103ad565b9050919050565b6103e6816103cc565b81146103f0575f5ffd5b50565b5f81359050610401816103dd565b92915050565b5f6020828403121561041c5761041b6103a9565b5b5f610429848285016103f3565b91505092915050565b61043b816103cc565b82525050565b5f6020820190506104545f830184610432565b92915050565b5f8115159050919050565b61046e8161045a565b82525050565b5f6020820190506104875f830184610465565b92915050565b5f8151905061049b816103dd565b92915050565b5f602082840312156104b6576104b56103a9565b5b5f6104c38482850161048d565b91505092915050565b6104d58161045a565b81146104df575f5ffd5b50565b5f815190506104f0816104cc565b92915050565b5f6020828403121561050b5761050a6103a9565b5b5f610518848285016104e2565b9150509291505056fea2646970667358221220c0805c3839e4cdda5cf3bb28b27dd8b8b54acb556f1d2c0bbb1fab193e30792e64736f6c634300081e0033", } // RewardManagerTestABI is the input ABI used to generate the binding from. From 9be0e677b4985fbf02718e99011b00bfa768f66b Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Wed, 10 Dec 2025 15:44:44 -0500 Subject: [PATCH 69/73] refactor: make verifyAndExtractWarpMessage a static helper --- tests/warp/warp_test.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 68d751133b..e118087b39 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -298,7 +298,7 @@ func (w *warpTest) sendMessageFromSendingSubnet() { blockHash, blockNumber := w.sendWarpMessageTx(ctx, client) w.blockID = ids.ID(blockHash) - w.verifyAndExtractWarpMessage(ctx, client, blockNumber, w.sendingSubnetFundedAddress) + w.addressedCallUnsignedMessage = verifyAndExtractWarpMessage(ctx, client, blockNumber, w.sendingSubnetFundedAddress) log.Info("Parsed unsignedWarpMsg", "unsignedWarpMessageID", w.addressedCallUnsignedMessage.ID(), "unsignedWarpMessage", w.addressedCallUnsignedMessage, @@ -365,15 +365,14 @@ func (w *warpTest) sendWarpMessageTx(ctx context.Context, client ethclient.Clien // verifyAndExtractWarpMessage queries the given block for SendWarpMessage events // emitted by the specified sender using the IWarpMessengerFilterer binding. It -// asserts that exactly one such event exists and then parses the unsigned warp -// message from the event. The unsigned warp message is stored in -// w.addressedCallUnsignedMessage for use in subsequent test steps. -func (w *warpTest) verifyAndExtractWarpMessage( +// asserts that exactly one such event exists and returns the parsed unsigned +// warp message. +func verifyAndExtractWarpMessage( ctx context.Context, client ethclient.Client, blockNumber uint64, sender common.Address, -) { +) *avalancheWarp.UnsignedMessage { require := require.New(ginkgo.GinkgoT()) log.Info("Filtering SendWarpMessage events using binding") @@ -402,11 +401,13 @@ func (w *warpTest) verifyAndExtractWarpMessage( require.Equal(sender, event.Sender) - w.addressedCallUnsignedMessage, err = avalancheWarp.ParseUnsignedMessage(event.Message) + unsignedMessage, err := avalancheWarp.ParseUnsignedMessage(event.Message) require.NoError(err) require.False(iter.Next(), "expected exactly one SendWarpMessage event") require.NoError(iter.Error()) + + return unsignedMessage } func (w *warpTest) aggregateSignaturesViaAPI() { @@ -629,9 +630,9 @@ func (w *warpTest) warpBindingsTest() { require.NoError(err) require.Equal(types.ReceiptStatusSuccessful, sendReceipt.Status) - w.verifyAndExtractWarpMessage(ctx, client, sendReceipt.BlockNumber.Uint64(), proxyAddr) + unsignedMsg := verifyAndExtractWarpMessage(ctx, client, sendReceipt.BlockNumber.Uint64(), proxyAddr) - addressedCall, err := warpPayload.ParseAddressedCall(w.addressedCallUnsignedMessage.Payload) + addressedCall, err := warpPayload.ParseAddressedCall(unsignedMsg.Payload) require.NoError(err) require.Equal(testPayload, addressedCall.Payload, "payload mismatch in warp message") From 7a55db4baf6ca57305da4f86a0b1914c4dc53285 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 11 Dec 2025 16:24:30 -0500 Subject: [PATCH 70/73] docs: add arran comment note --- .../warp/warptest/bindings/WarpTest.sol | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/precompile/contracts/warp/warptest/bindings/WarpTest.sol b/precompile/contracts/warp/warptest/bindings/WarpTest.sol index 426138d974..8e9a33a2af 100644 --- a/precompile/contracts/warp/warptest/bindings/WarpTest.sol +++ b/precompile/contracts/warp/warptest/bindings/WarpTest.sol @@ -3,6 +3,22 @@ pragma solidity ^0.8.24; import "precompile/contracts/warp/warpbindings/IWarpMessenger.sol"; + +// Assuming there is some IPrecompile.sol and a respective ABI, there are two scenarios for a Go TestPrecompile: +// 1. TestPrecompile -> abigen bindings -> precompile. +// 2. TestPrecompile -> intermediary contract1 -> IPrecompile -> precompile. +// +// Since we expect an end user to consume IPrecompile in their own smart contract, we MUST be including it as +// part of the SUT (i.e. IPrecompile + precompile). Achieving this with (2) is self-evident. +// To achieve this with (1) we MUST have the ABI+bindings generated from IPrecompile and the results confirmed by CI2. +// +// It is not sufficient to say that the precompile was generated from some ABI of unknown provenance and that it's the +// source of truth because then the tests exclude a key element on which our users depend. +// +// Note that the intermediary contract can be called any way, e.g. with its own abigen bindings, but for tests +// that don't require dynamic arguments it can be no more than a constructor with revert()s, and then successful +//deployment is the test. + contract WarpTest { IWarpMessenger private warp; From 20cd6be879ef79dbf961a4b39c168877d59f61fd Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 11 Dec 2025 16:35:48 -0500 Subject: [PATCH 71/73] chore: regenerate bindings --- .../contracts/warp/warptest/bindings/gen_warptest_binding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go b/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go index 95f5d24ca6..97430d569f 100644 --- a/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go +++ b/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go @@ -45,7 +45,7 @@ type WarpMessage struct { // WarpTestMetaData contains all meta data concerning the WarpTest contract. var WarpTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"warpPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpBlockHash\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"internalType\":\"structWarpBlockHash\",\"name\":\"warpBlockHash\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpMessage\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"internalType\":\"structWarpMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"sendWarpMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610bd5380380610bd5833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610ac98061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634213cf781461004e5780636f8253501461006c578063ce7f59291461009d578063ee5b48eb146100ce575b5f5ffd5b6100566100fe565b60405161006391906103f1565b60405180910390f35b61008660048036038101906100819190610454565b610191565b6040516100949291906105a4565b60405180910390f35b6100b760048036038101906100b29190610454565b61023e565b6040516100c59291906105ff565b60405180910390f35b6100e860048036038101906100e39190610687565b6102e8565b6040516100f591906103f1565b60405180910390f35b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061018c91906106fc565b905090565b61019961038c565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350846040518263ffffffff1660e01b81526004016101f39190610736565b5f60405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906102359190610942565b91509150915091565b6102466103c1565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929846040518263ffffffff1660e01b81526004016102a09190610736565b606060405180830381865afa1580156102bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102df91906109e9565b91509150915091565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee5b48eb84846040518363ffffffff1660e01b8152600401610344929190610a71565b6020604051808303815f875af1158015610360573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061038491906106fc565b905092915050565b60405180606001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff168152602001606081525090565b60405180604001604052805f81526020015f81525090565b5f819050919050565b6103eb816103d9565b82525050565b5f6020820190506104045f8301846103e2565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f63ffffffff82169050919050565b6104338161041b565b811461043d575f5ffd5b50565b5f8135905061044e8161042a565b92915050565b5f6020828403121561046957610468610413565b5b5f61047684828501610440565b91505092915050565b610488816103d9565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6104b78261048e565b9050919050565b6104c7816104ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61050f826104cd565b61051981856104d7565b93506105298185602086016104e7565b610532816104f5565b840191505092915050565b5f606083015f8301516105525f86018261047f565b50602083015161056560208601826104be565b506040830151848203604086015261057d8282610505565b9150508091505092915050565b5f8115159050919050565b61059e8161058a565b82525050565b5f6040820190508181035f8301526105bc818561053d565b90506105cb6020830184610595565b9392505050565b604082015f8201516105e65f85018261047f565b5060208201516105f9602085018261047f565b50505050565b5f6060820190506106125f8301856105d2565b61061f6040830184610595565b9392505050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261064757610646610626565b5b8235905067ffffffffffffffff8111156106645761066361062a565b5b6020830191508360018202830111156106805761067f61062e565b5b9250929050565b5f5f6020838503121561069d5761069c610413565b5b5f83013567ffffffffffffffff8111156106ba576106b9610417565b5b6106c685828601610632565b92509250509250929050565b6106db816103d9565b81146106e5575f5ffd5b50565b5f815190506106f6816106d2565b92915050565b5f6020828403121561071157610710610413565b5b5f61071e848285016106e8565b91505092915050565b6107308161041b565b82525050565b5f6020820190506107495f830184610727565b92915050565b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610789826104f5565b810181811067ffffffffffffffff821117156107a8576107a7610753565b5b80604052505050565b5f6107ba61040a565b90506107c68282610780565b919050565b5f5ffd5b6107d8816104ad565b81146107e2575f5ffd5b50565b5f815190506107f3816107cf565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561081757610816610753565b5b610820826104f5565b9050602081019050919050565b5f61083f61083a846107fd565b6107b1565b90508281526020810184848401111561085b5761085a6107f9565b5b6108668482856104e7565b509392505050565b5f82601f83011261088257610881610626565b5b815161089284826020860161082d565b91505092915050565b5f606082840312156108b0576108af61074f565b5b6108ba60606107b1565b90505f6108c9848285016106e8565b5f8301525060206108dc848285016107e5565b602083015250604082015167ffffffffffffffff811115610900576108ff6107cb565b5b61090c8482850161086e565b60408301525092915050565b6109218161058a565b811461092b575f5ffd5b50565b5f8151905061093c81610918565b92915050565b5f5f6040838503121561095857610957610413565b5b5f83015167ffffffffffffffff81111561097557610974610417565b5b6109818582860161089b565b92505060206109928582860161092e565b9150509250929050565b5f604082840312156109b1576109b061074f565b5b6109bb60406107b1565b90505f6109ca848285016106e8565b5f8301525060206109dd848285016106e8565b60208301525092915050565b5f5f606083850312156109ff576109fe610413565b5b5f610a0c8582860161099c565b9250506040610a1d8582860161092e565b9150509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f610a508385610a27565b9350610a5d838584610a37565b610a66836104f5565b840190509392505050565b5f6020820190508181035f830152610a8a818486610a45565b9050939250505056fea2646970667358221220537e0b452c503ba2e974e6beed91913ed7b0dc136f3efe6b6ad3809139e7356364736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610bd5380380610bd5833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610ac98061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634213cf781461004e5780636f8253501461006c578063ce7f59291461009d578063ee5b48eb146100ce575b5f5ffd5b6100566100fe565b60405161006391906103f1565b60405180910390f35b61008660048036038101906100819190610454565b610191565b6040516100949291906105a4565b60405180910390f35b6100b760048036038101906100b29190610454565b61023e565b6040516100c59291906105ff565b60405180910390f35b6100e860048036038101906100e39190610687565b6102e8565b6040516100f591906103f1565b60405180910390f35b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061018c91906106fc565b905090565b61019961038c565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350846040518263ffffffff1660e01b81526004016101f39190610736565b5f60405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906102359190610942565b91509150915091565b6102466103c1565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929846040518263ffffffff1660e01b81526004016102a09190610736565b606060405180830381865afa1580156102bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102df91906109e9565b91509150915091565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee5b48eb84846040518363ffffffff1660e01b8152600401610344929190610a71565b6020604051808303815f875af1158015610360573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061038491906106fc565b905092915050565b60405180606001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff168152602001606081525090565b60405180604001604052805f81526020015f81525090565b5f819050919050565b6103eb816103d9565b82525050565b5f6020820190506104045f8301846103e2565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f63ffffffff82169050919050565b6104338161041b565b811461043d575f5ffd5b50565b5f8135905061044e8161042a565b92915050565b5f6020828403121561046957610468610413565b5b5f61047684828501610440565b91505092915050565b610488816103d9565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6104b78261048e565b9050919050565b6104c7816104ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61050f826104cd565b61051981856104d7565b93506105298185602086016104e7565b610532816104f5565b840191505092915050565b5f606083015f8301516105525f86018261047f565b50602083015161056560208601826104be565b506040830151848203604086015261057d8282610505565b9150508091505092915050565b5f8115159050919050565b61059e8161058a565b82525050565b5f6040820190508181035f8301526105bc818561053d565b90506105cb6020830184610595565b9392505050565b604082015f8201516105e65f85018261047f565b5060208201516105f9602085018261047f565b50505050565b5f6060820190506106125f8301856105d2565b61061f6040830184610595565b9392505050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261064757610646610626565b5b8235905067ffffffffffffffff8111156106645761066361062a565b5b6020830191508360018202830111156106805761067f61062e565b5b9250929050565b5f5f6020838503121561069d5761069c610413565b5b5f83013567ffffffffffffffff8111156106ba576106b9610417565b5b6106c685828601610632565b92509250509250929050565b6106db816103d9565b81146106e5575f5ffd5b50565b5f815190506106f6816106d2565b92915050565b5f6020828403121561071157610710610413565b5b5f61071e848285016106e8565b91505092915050565b6107308161041b565b82525050565b5f6020820190506107495f830184610727565b92915050565b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610789826104f5565b810181811067ffffffffffffffff821117156107a8576107a7610753565b5b80604052505050565b5f6107ba61040a565b90506107c68282610780565b919050565b5f5ffd5b6107d8816104ad565b81146107e2575f5ffd5b50565b5f815190506107f3816107cf565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561081757610816610753565b5b610820826104f5565b9050602081019050919050565b5f61083f61083a846107fd565b6107b1565b90508281526020810184848401111561085b5761085a6107f9565b5b6108668482856104e7565b509392505050565b5f82601f83011261088257610881610626565b5b815161089284826020860161082d565b91505092915050565b5f606082840312156108b0576108af61074f565b5b6108ba60606107b1565b90505f6108c9848285016106e8565b5f8301525060206108dc848285016107e5565b602083015250604082015167ffffffffffffffff811115610900576108ff6107cb565b5b61090c8482850161086e565b60408301525092915050565b6109218161058a565b811461092b575f5ffd5b50565b5f8151905061093c81610918565b92915050565b5f5f6040838503121561095857610957610413565b5b5f83015167ffffffffffffffff81111561097557610974610417565b5b6109818582860161089b565b92505060206109928582860161092e565b9150509250929050565b5f604082840312156109b1576109b061074f565b5b6109bb60406107b1565b90505f6109ca848285016106e8565b5f8301525060206109dd848285016106e8565b60208301525092915050565b5f5f606083850312156109ff576109fe610413565b5b5f610a0c8582860161099c565b9250506040610a1d8582860161092e565b9150509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f610a508385610a27565b9350610a5d838584610a37565b610a66836104f5565b840190509392505050565b5f6020820190508181035f830152610a8a818486610a45565b9050939250505056fea26469706673582212208d65672a37c812f0bde00a8d46e07497f3eab0c780cdd2dbf5f39a8020cb85ba64736f6c634300081e0033", } // WarpTestABI is the input ABI used to generate the binding from. From 5ab245f2d93e2f07124032fdd7c67ca13e346473 Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 11 Dec 2025 16:36:52 -0500 Subject: [PATCH 72/73] Update precompile/contracts/warp/warptest/bindings/WarpTest.sol Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com> Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com> --- .../warp/warptest/bindings/WarpTest.sol | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/precompile/contracts/warp/warptest/bindings/WarpTest.sol b/precompile/contracts/warp/warptest/bindings/WarpTest.sol index 8e9a33a2af..bcc0667922 100644 --- a/precompile/contracts/warp/warptest/bindings/WarpTest.sol +++ b/precompile/contracts/warp/warptest/bindings/WarpTest.sol @@ -4,21 +4,10 @@ pragma solidity ^0.8.24; import "precompile/contracts/warp/warpbindings/IWarpMessenger.sol"; -// Assuming there is some IPrecompile.sol and a respective ABI, there are two scenarios for a Go TestPrecompile: -// 1. TestPrecompile -> abigen bindings -> precompile. -// 2. TestPrecompile -> intermediary contract1 -> IPrecompile -> precompile. -// -// Since we expect an end user to consume IPrecompile in their own smart contract, we MUST be including it as -// part of the SUT (i.e. IPrecompile + precompile). Achieving this with (2) is self-evident. -// To achieve this with (1) we MUST have the ABI+bindings generated from IPrecompile and the results confirmed by CI2. -// -// It is not sufficient to say that the precompile was generated from some ABI of unknown provenance and that it's the -// source of truth because then the tests exclude a key element on which our users depend. -// -// Note that the intermediary contract can be called any way, e.g. with its own abigen bindings, but for tests -// that don't require dynamic arguments it can be no more than a constructor with revert()s, and then successful -//deployment is the test. - +// This test contract exists to ensure that `IWarpPrecomile.sol` is properly covered by precompile tests. +// By invoking the precompile via a proxy contract that leverages the `IWarpPrecompile.sol` interface, +// we ensure the interface definition matches the precompile implementation regardless of how the proxy +// contract itself is invoked. contract WarpTest { IWarpMessenger private warp; From daf8bc3d7556fb082f589220519aaa3e15aa16ff Mon Sep 17 00:00:00 2001 From: Jonathan Oppenheimer Date: Thu, 11 Dec 2025 16:39:51 -0500 Subject: [PATCH 73/73] chore: regenerate bindings --- .../contracts/warp/warptest/bindings/gen_warptest_binding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go b/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go index 97430d569f..dc172fcc7f 100644 --- a/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go +++ b/precompile/contracts/warp/warptest/bindings/gen_warptest_binding.go @@ -45,7 +45,7 @@ type WarpMessage struct { // WarpTestMetaData contains all meta data concerning the WarpTest contract. var WarpTestMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"warpPrecompile\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"getBlockchainID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpBlockHash\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"internalType\":\"structWarpBlockHash\",\"name\":\"warpBlockHash\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"index\",\"type\":\"uint32\"}],\"name\":\"getVerifiedWarpMessage\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"originSenderAddress\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"internalType\":\"structWarpMessage\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"}],\"name\":\"sendWarpMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"messageID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f5ffd5b50604051610bd5380380610bd5833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610ac98061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634213cf781461004e5780636f8253501461006c578063ce7f59291461009d578063ee5b48eb146100ce575b5f5ffd5b6100566100fe565b60405161006391906103f1565b60405180910390f35b61008660048036038101906100819190610454565b610191565b6040516100949291906105a4565b60405180910390f35b6100b760048036038101906100b29190610454565b61023e565b6040516100c59291906105ff565b60405180910390f35b6100e860048036038101906100e39190610687565b6102e8565b6040516100f591906103f1565b60405180910390f35b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061018c91906106fc565b905090565b61019961038c565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350846040518263ffffffff1660e01b81526004016101f39190610736565b5f60405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906102359190610942565b91509150915091565b6102466103c1565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929846040518263ffffffff1660e01b81526004016102a09190610736565b606060405180830381865afa1580156102bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102df91906109e9565b91509150915091565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee5b48eb84846040518363ffffffff1660e01b8152600401610344929190610a71565b6020604051808303815f875af1158015610360573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061038491906106fc565b905092915050565b60405180606001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff168152602001606081525090565b60405180604001604052805f81526020015f81525090565b5f819050919050565b6103eb816103d9565b82525050565b5f6020820190506104045f8301846103e2565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f63ffffffff82169050919050565b6104338161041b565b811461043d575f5ffd5b50565b5f8135905061044e8161042a565b92915050565b5f6020828403121561046957610468610413565b5b5f61047684828501610440565b91505092915050565b610488816103d9565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6104b78261048e565b9050919050565b6104c7816104ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61050f826104cd565b61051981856104d7565b93506105298185602086016104e7565b610532816104f5565b840191505092915050565b5f606083015f8301516105525f86018261047f565b50602083015161056560208601826104be565b506040830151848203604086015261057d8282610505565b9150508091505092915050565b5f8115159050919050565b61059e8161058a565b82525050565b5f6040820190508181035f8301526105bc818561053d565b90506105cb6020830184610595565b9392505050565b604082015f8201516105e65f85018261047f565b5060208201516105f9602085018261047f565b50505050565b5f6060820190506106125f8301856105d2565b61061f6040830184610595565b9392505050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261064757610646610626565b5b8235905067ffffffffffffffff8111156106645761066361062a565b5b6020830191508360018202830111156106805761067f61062e565b5b9250929050565b5f5f6020838503121561069d5761069c610413565b5b5f83013567ffffffffffffffff8111156106ba576106b9610417565b5b6106c685828601610632565b92509250509250929050565b6106db816103d9565b81146106e5575f5ffd5b50565b5f815190506106f6816106d2565b92915050565b5f6020828403121561071157610710610413565b5b5f61071e848285016106e8565b91505092915050565b6107308161041b565b82525050565b5f6020820190506107495f830184610727565b92915050565b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610789826104f5565b810181811067ffffffffffffffff821117156107a8576107a7610753565b5b80604052505050565b5f6107ba61040a565b90506107c68282610780565b919050565b5f5ffd5b6107d8816104ad565b81146107e2575f5ffd5b50565b5f815190506107f3816107cf565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561081757610816610753565b5b610820826104f5565b9050602081019050919050565b5f61083f61083a846107fd565b6107b1565b90508281526020810184848401111561085b5761085a6107f9565b5b6108668482856104e7565b509392505050565b5f82601f83011261088257610881610626565b5b815161089284826020860161082d565b91505092915050565b5f606082840312156108b0576108af61074f565b5b6108ba60606107b1565b90505f6108c9848285016106e8565b5f8301525060206108dc848285016107e5565b602083015250604082015167ffffffffffffffff811115610900576108ff6107cb565b5b61090c8482850161086e565b60408301525092915050565b6109218161058a565b811461092b575f5ffd5b50565b5f8151905061093c81610918565b92915050565b5f5f6040838503121561095857610957610413565b5b5f83015167ffffffffffffffff81111561097557610974610417565b5b6109818582860161089b565b92505060206109928582860161092e565b9150509250929050565b5f604082840312156109b1576109b061074f565b5b6109bb60406107b1565b90505f6109ca848285016106e8565b5f8301525060206109dd848285016106e8565b60208301525092915050565b5f5f606083850312156109ff576109fe610413565b5b5f610a0c8582860161099c565b9250506040610a1d8582860161092e565b9150509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f610a508385610a27565b9350610a5d838584610a37565b610a66836104f5565b840190509392505050565b5f6020820190508181035f830152610a8a818486610a45565b9050939250505056fea26469706673582212208d65672a37c812f0bde00a8d46e07497f3eab0c780cdd2dbf5f39a8020cb85ba64736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b50604051610bd5380380610bd5833981810160405281019061003191906100d4565b805f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506100ff565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100a38261007a565b9050919050565b6100b381610099565b81146100bd575f5ffd5b50565b5f815190506100ce816100aa565b92915050565b5f602082840312156100e9576100e8610076565b5b5f6100f6848285016100c0565b91505092915050565b610ac98061010c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634213cf781461004e5780636f8253501461006c578063ce7f59291461009d578063ee5b48eb146100ce575b5f5ffd5b6100566100fe565b60405161006391906103f1565b60405180910390f35b61008660048036038101906100819190610454565b610191565b6040516100949291906105a4565b60405180910390f35b6100b760048036038101906100b29190610454565b61023e565b6040516100c59291906105ff565b60405180910390f35b6100e860048036038101906100e39190610687565b6102e8565b6040516100f591906103f1565b60405180910390f35b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610168573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061018c91906106fc565b905090565b61019961038c565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636f825350846040518263ffffffff1660e01b81526004016101f39190610736565b5f60405180830381865afa15801561020d573d5f5f3e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906102359190610942565b91509150915091565b6102466103c1565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce7f5929846040518263ffffffff1660e01b81526004016102a09190610736565b606060405180830381865afa1580156102bb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102df91906109e9565b91509150915091565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee5b48eb84846040518363ffffffff1660e01b8152600401610344929190610a71565b6020604051808303815f875af1158015610360573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061038491906106fc565b905092915050565b60405180606001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff168152602001606081525090565b60405180604001604052805f81526020015f81525090565b5f819050919050565b6103eb816103d9565b82525050565b5f6020820190506104045f8301846103e2565b92915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f63ffffffff82169050919050565b6104338161041b565b811461043d575f5ffd5b50565b5f8135905061044e8161042a565b92915050565b5f6020828403121561046957610468610413565b5b5f61047684828501610440565b91505092915050565b610488816103d9565b82525050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6104b78261048e565b9050919050565b6104c7816104ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61050f826104cd565b61051981856104d7565b93506105298185602086016104e7565b610532816104f5565b840191505092915050565b5f606083015f8301516105525f86018261047f565b50602083015161056560208601826104be565b506040830151848203604086015261057d8282610505565b9150508091505092915050565b5f8115159050919050565b61059e8161058a565b82525050565b5f6040820190508181035f8301526105bc818561053d565b90506105cb6020830184610595565b9392505050565b604082015f8201516105e65f85018261047f565b5060208201516105f9602085018261047f565b50505050565b5f6060820190506106125f8301856105d2565b61061f6040830184610595565b9392505050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261064757610646610626565b5b8235905067ffffffffffffffff8111156106645761066361062a565b5b6020830191508360018202830111156106805761067f61062e565b5b9250929050565b5f5f6020838503121561069d5761069c610413565b5b5f83013567ffffffffffffffff8111156106ba576106b9610417565b5b6106c685828601610632565b92509250509250929050565b6106db816103d9565b81146106e5575f5ffd5b50565b5f815190506106f6816106d2565b92915050565b5f6020828403121561071157610710610413565b5b5f61071e848285016106e8565b91505092915050565b6107308161041b565b82525050565b5f6020820190506107495f830184610727565b92915050565b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610789826104f5565b810181811067ffffffffffffffff821117156107a8576107a7610753565b5b80604052505050565b5f6107ba61040a565b90506107c68282610780565b919050565b5f5ffd5b6107d8816104ad565b81146107e2575f5ffd5b50565b5f815190506107f3816107cf565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561081757610816610753565b5b610820826104f5565b9050602081019050919050565b5f61083f61083a846107fd565b6107b1565b90508281526020810184848401111561085b5761085a6107f9565b5b6108668482856104e7565b509392505050565b5f82601f83011261088257610881610626565b5b815161089284826020860161082d565b91505092915050565b5f606082840312156108b0576108af61074f565b5b6108ba60606107b1565b90505f6108c9848285016106e8565b5f8301525060206108dc848285016107e5565b602083015250604082015167ffffffffffffffff811115610900576108ff6107cb565b5b61090c8482850161086e565b60408301525092915050565b6109218161058a565b811461092b575f5ffd5b50565b5f8151905061093c81610918565b92915050565b5f5f6040838503121561095857610957610413565b5b5f83015167ffffffffffffffff81111561097557610974610417565b5b6109818582860161089b565b92505060206109928582860161092e565b9150509250929050565b5f604082840312156109b1576109b061074f565b5b6109bb60406107b1565b90505f6109ca848285016106e8565b5f8301525060206109dd848285016106e8565b60208301525092915050565b5f5f606083850312156109ff576109fe610413565b5b5f610a0c8582860161099c565b9250506040610a1d8582860161092e565b9150509250929050565b5f82825260208201905092915050565b828183375f83830152505050565b5f610a508385610a27565b9350610a5d838584610a37565b610a66836104f5565b840190509392505050565b5f6020820190508181035f830152610a8a818486610a45565b9050939250505056fea26469706673582212208d14f752848aa9d15d2a4fdb9190892ea8e4d281777679d708d9c3996ea7358f64736f6c634300081e0033", } // WarpTestABI is the input ABI used to generate the binding from.