Skip to content

Commit

Permalink
update genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Oct 22, 2024
1 parent 13af009 commit 13d2d6b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 80 deletions.
64 changes: 0 additions & 64 deletions contracts/binding/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,67 +1,3 @@
// DO NOT EDIT! This file was generated by build.rs
#[macro_use]
mod convert;
#[allow(clippy::all)]
pub mod checkpointing_facet;
#[allow(clippy::all)]
pub mod diamond_cut_facet;
#[allow(clippy::all)]
pub mod diamond_loupe_facet;
#[allow(clippy::all)]
pub mod gateway_diamond;
#[allow(clippy::all)]
pub mod gateway_getter_facet;
#[allow(clippy::all)]
pub mod gateway_manager_facet;
#[allow(clippy::all)]
pub mod gateway_messenger_facet;
#[allow(clippy::all)]
pub mod i_diamond;
#[allow(clippy::all)]
pub mod lib_gateway;
#[allow(clippy::all)]
pub mod lib_quorum;
#[allow(clippy::all)]
pub mod lib_staking;
#[allow(clippy::all)]
pub mod lib_staking_change_log;
#[allow(clippy::all)]
pub mod ownership_facet;
#[allow(clippy::all)]
pub mod register_subnet_facet;
#[allow(clippy::all)]
pub mod subnet_actor_checkpointing_facet;
#[allow(clippy::all)]
pub mod subnet_actor_diamond;
#[allow(clippy::all)]
pub mod subnet_actor_getter_facet;
#[allow(clippy::all)]
pub mod subnet_actor_manager_facet;
#[allow(clippy::all)]
pub mod subnet_actor_pause_facet;
#[allow(clippy::all)]
pub mod subnet_actor_reward_facet;
#[allow(clippy::all)]
pub mod subnet_getter_facet;
#[allow(clippy::all)]
pub mod subnet_registry_diamond;
#[allow(clippy::all)]
pub mod top_down_finality_facet;
#[allow(clippy::all)]
pub mod validator_reward_facet;
#[allow(clippy::all)]
pub mod xnet_messaging_facet;

// The list of contracts need to convert FvmAddress to fvm_shared::Address
fvm_address_conversion!(gateway_manager_facet);
fvm_address_conversion!(gateway_getter_facet);
fvm_address_conversion!(xnet_messaging_facet);
fvm_address_conversion!(gateway_messenger_facet);
fvm_address_conversion!(subnet_actor_checkpointing_facet);
fvm_address_conversion!(subnet_actor_getter_facet);
fvm_address_conversion!(lib_gateway);
fvm_address_conversion!(checkpointing_facet);

// The list of contracts that need to convert common types between each other
common_type_conversion!(subnet_actor_getter_facet, checkpointing_facet);
common_type_conversion!(subnet_actor_getter_facet, xnet_messaging_facet);
10 changes: 8 additions & 2 deletions contracts/tasks/deploy-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ task('deploy-registry')
},
{ name: 'SubnetActorPauseFacet' },
{ name: 'SubnetActorRewardFacet' },
{ name: 'SubnetActorCheckpointingFacet' },
{
name: 'SubnetActorCheckpointingFacet',
libraries: ['SubnetIDHelper'],
},
{ name: 'DiamondCutFacet' },
{ name: 'DiamondLoupeFacet' },
{ name: 'OwnershipFacet' },
{ name: 'ValidatorRewardFacet' },
{
name: 'ValidatorRewardFacet',
libraries: ['SubnetIDHelper'],
},
)

const registryFacets = await Deployments.deploy(
Expand Down
22 changes: 11 additions & 11 deletions contracts/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ task(
async (args, hre: HardhatRuntimeEnvironment) => {
await hre.run('compile')

console.log()
console.log(
'==== LIBRARY DEPLOYMENT ===========================================================================',
)
await hre.run('deploy-libraries')
console.log()
// console.log()
// console.log(
// '==== LIBRARY DEPLOYMENT ===========================================================================',
// )
// await hre.run('deploy-libraries')
// console.log()

console.log(
'==== GATEWAY DEPLOYMENT ===========================================================================',
)
await hre.run('deploy-gateway')
console.log()
// console.log(
// '==== GATEWAY DEPLOYMENT ===========================================================================',
// )
// await hre.run('deploy-gateway')
// console.log()

console.log(
'==== REGISTRY DEPLOYMENT ==========================================================================',
Expand Down
24 changes: 24 additions & 0 deletions contracts/tasks/validator-rewarder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,27 @@ task('validator-rewarder-deploy')
libraries: [],
})
})

// step 2. set the subnet for the rewarder
// sample command: pnpm exec hardhat validator-rewarder-set-subnet --network calibrationnet 314159 <YOUR SUBNET ETH ROUTE ADDRESS>
task('validator-rewarder-set-subnet')
.setDescription('Deploy example subnet validator rewarder contract')
.addPositionalParam('root', 'the chain id of parent subnet')
.addPositionalParam('address', 'the address of the subnet actor contract, L2 only')
.setAction(async (args: TaskArguments, hre: HardhatRuntimeEnvironment) => {
await hre.run('compile')

const [deployer] = await hre.getUnnamedAccounts()
const balance = await hre.ethers.provider.getBalance(deployer)
console.log(
`Set validator rewarder subnet with account: ${deployer} and balance: ${hre.ethers.utils.formatEther(balance.toString())}`,
)

// only L2 for now
const subnetId = { root: args.root, route: [args.address] }
console.log('pointing to', subnetId)

const contracts = await Deployments.resolve(hre, 'ValidatorRewarderMap')
const contract = contracts.contracts.ValidatorRewarderMap
await contract.setSubnet(subnetId)
})
15 changes: 12 additions & 3 deletions fendermint/vm/interpreter/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ use fendermint_eth_hardhat::{ContractSourceAndName, Hardhat, FQN};
use fendermint_vm_actor_interface::diamond::{EthContract, EthContractMap};
use fendermint_vm_actor_interface::eam::EthAddress;
use fendermint_vm_actor_interface::ipc::IPC_CONTRACTS;
use fendermint_vm_actor_interface::{
account, burntfunds, chainmetadata, cron, eam, gas_market, init, ipc, reward, system, EMPTY_ARR,
};
use fendermint_vm_actor_interface::{account, burntfunds, chainmetadata, cron, eam, gas_market, init, ipc, reward, system, EMPTY_ARR, activity};
use fendermint_vm_core::{chainid, Timestamp};
use fendermint_vm_genesis::{ActorMeta, Collateral, Genesis, Power, PowerScale, Validator};
use futures_util::io::Cursor;
Expand Down Expand Up @@ -452,6 +450,17 @@ impl GenesisBuilder {
)
.context("failed to create default eip1559 gas market actor")?;

let tracker_state = fendermint_actor_activity_tracker::State::new(state.store())?;
state
.create_custom_actor(
fendermint_actor_activity_tracker::IPC_ACTIVITY_TRACKER_ACTOR_NAME,
activity::ACTIVITY_TRACKER_ACTOR_ID,
&tracker_state,
TokenAmount::zero(),
None,
)
.context("failed to create activity tracker actor")?;

// STAGE 2: Create non-builtin accounts which do not have a fixed ID.

// The next ID is going to be _after_ the accounts, which have already been assigned an ID by the `Init` actor.
Expand Down

0 comments on commit 13d2d6b

Please sign in to comment.