Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
358 changes: 358 additions & 0 deletions simulations/vip-260/bsctestnet/abi/votesSyncReceiverAbi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,358 @@
[
{
"inputs": [
{ "internalType": "address", "name": "endpoint_", "type": "address" },
{ "internalType": "contract IMultichainVoteRegistry", "name": "multichainVoteRegistry_", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{ "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" },
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" },
{ "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" },
{ "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" },
{ "indexed": false, "internalType": "bytes", "name": "_payload", "type": "bytes" },
{ "indexed": false, "internalType": "bytes", "name": "_reason", "type": "bytes" }
],
"name": "MessageFailed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "uint16", "name": "remoteChainId", "type": "uint16" },
{ "indexed": false, "internalType": "bytes", "name": "remoteAddress", "type": "bytes" },
{ "indexed": false, "internalType": "uint64", "name": "nonce", "type": "uint64" },
{ "indexed": false, "internalType": "bytes", "name": "reason", "type": "bytes" }
],
"name": "ReceivePayloadFailed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint16", "name": "_srcChainId", "type": "uint16" },
{ "indexed": false, "internalType": "bytes", "name": "_srcAddress", "type": "bytes" },
{ "indexed": false, "internalType": "uint64", "name": "_nonce", "type": "uint64" },
{ "indexed": false, "internalType": "bytes32", "name": "_payloadHash", "type": "bytes32" }
],
"name": "RetryMessageSuccess",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint16", "name": "_dstChainId", "type": "uint16" },
{ "indexed": false, "internalType": "uint16", "name": "_type", "type": "uint16" },
{ "indexed": false, "internalType": "uint256", "name": "_minDstGas", "type": "uint256" }
],
"name": "SetMinDstGas",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "precrime", "type": "address" }],
"name": "SetPrecrime",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" },
{ "indexed": false, "internalType": "bytes", "name": "_path", "type": "bytes" }
],
"name": "SetTrustedRemote",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" },
{ "indexed": false, "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" }
],
"name": "SetTrustedRemoteAddress",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }],
"name": "TrustedRemoteRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "address", "name": "delegatee", "type": "address" },
{ "indexed": false, "internalType": "uint32", "name": "checkpoints", "type": "uint32" },
{ "indexed": true, "internalType": "uint96", "name": "votes", "type": "uint96" },
{ "indexed": false, "internalType": "uint32", "name": "nCheckpoint", "type": "uint32" }
],
"name": "VotesSynced",
"type": "event"
},
{
"inputs": [],
"name": "DEFAULT_PAYLOAD_SIZE_LIMIT",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "", "type": "uint16" },
{ "internalType": "bytes", "name": "", "type": "bytes" },
{ "internalType": "uint64", "name": "", "type": "uint64" }
],
"name": "failedMessages",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_srcChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }
],
"name": "forceResumeReceive",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_version", "type": "uint16" },
{ "internalType": "uint16", "name": "_chainId", "type": "uint16" },
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "uint256", "name": "_configType", "type": "uint256" }
],
"name": "getConfig",
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" }],
"name": "getTrustedRemoteAddress",
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_srcChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "_srcAddress", "type": "bytes" }
],
"name": "isTrustedRemote",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lzEndpoint",
"outputs": [{ "internalType": "contract ILayerZeroEndpoint", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_srcChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "_srcAddress", "type": "bytes" },
{ "internalType": "uint64", "name": "_nonce", "type": "uint64" },
{ "internalType": "bytes", "name": "_payload", "type": "bytes" }
],
"name": "lzReceive",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "", "type": "uint16" },
{ "internalType": "uint16", "name": "", "type": "uint16" }
],
"name": "minDstGasLookup",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "multichainVoteRegistry",
"outputs": [{ "internalType": "contract IMultichainVoteRegistry", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_srcChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "_srcAddress", "type": "bytes" },
{ "internalType": "uint64", "name": "_nonce", "type": "uint64" },
{ "internalType": "bytes", "name": "_payload", "type": "bytes" }
],
"name": "nonblockingLzReceive",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "paused",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
"name": "payloadSizeLimitLookup",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "precrime",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }],
"name": "removeTrustedRemote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
{
"inputs": [
{ "internalType": "uint16", "name": "srcChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "srcAddress", "type": "bytes" },
{ "internalType": "uint64", "name": "nonce", "type": "uint64" },
{ "internalType": "bytes", "name": "payload", "type": "bytes" }
],
"name": "retryMessage",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_version", "type": "uint16" },
{ "internalType": "uint16", "name": "_chainId", "type": "uint16" },
{ "internalType": "uint256", "name": "_configType", "type": "uint256" },
{ "internalType": "bytes", "name": "_config", "type": "bytes" }
],
"name": "setConfig",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_dstChainId", "type": "uint16" },
{ "internalType": "uint16", "name": "_packetType", "type": "uint16" },
{ "internalType": "uint256", "name": "_minGas", "type": "uint256" }
],
"name": "setMinDstGas",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_dstChainId", "type": "uint16" },
{ "internalType": "uint256", "name": "_size", "type": "uint256" }
],
"name": "setPayloadSizeLimit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "_precrime", "type": "address" }],
"name": "setPrecrime",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }],
"name": "setReceiveVersion",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "_version", "type": "uint16" }],
"name": "setSendVersion",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "_path", "type": "bytes" }
],
"name": "setTrustedRemote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint16", "name": "_remoteChainId", "type": "uint16" },
{ "internalType": "bytes", "name": "_remoteAddress", "type": "bytes" }
],
"name": "setTrustedRemoteAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
"name": "trustedRemoteLookup",
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
"stateMutability": "view",
"type": "function"
}
]
38 changes: 38 additions & 0 deletions simulations/vip-260/bsctestnet/simulations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { expect } from "chai";
import { ethers } from "hardhat";

import { NETWORK_ADDRESSES } from "../../../src/networkAddresses";
import { networkChainIds } from "../../../src/utils";
import { forking, pretendExecutingVip } from "../../../src/vip-framework";
import { vip260Testnet } from "../../../vips/vip-260/bsctestnet";
import VotesSyncReceiver_ABI from "./abi/votesSyncReceiverAbi.json";

const { bsctestnet } = NETWORK_ADDRESSES;

forking(37908025, async () => {
const provider = ethers.provider;
let votesSyncReceiver: ethers.Contract;

before(async () => {
votesSyncReceiver = new ethers.Contract(bsctestnet.VOTE_SYNC_RECEIVER, VotesSyncReceiver_ABI, provider);
});

describe("Pre-VIP behaviour", async () => {
it("Trusted remote is not set", async () => {
expect(await votesSyncReceiver.trustedRemoteLookup(networkChainIds["sepolia"])).to.equal("0x");
});
});

describe("Post-VIP behaviour", async () => {
before(async () => {
await pretendExecutingVip(vip260Testnet());
});
it("Trusted remote is set", async () => {
const destinationAdd = ethers.utils.solidityPack(
["address", "address"],
[bsctestnet.VOTE_SYNC_SENDER, bsctestnet.VOTE_SYNC_RECEIVER],
);
expect(await votesSyncReceiver.trustedRemoteLookup(networkChainIds["sepolia"])).to.equal(destinationAdd);
});
});
});
Loading