Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/__tests__/railgun-engine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ describe('railgun-engine', function test() {
{ [TXIDVersion.V2_PoseidonMerkle]: 24, [TXIDVersion.V3_PoseidonMerkle]: 24 },
0,
!isV2Test(), // supportsV3
config.contracts.relayAdapt7702,
config.contracts.railgunRegistry,
);

const balance = await token.balanceOf(ethersWallet.address);
Expand Down
27 changes: 27 additions & 0 deletions src/__tests__/relay-adapt-7702-registry.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { expect } from 'chai';
import { RailgunEngine } from '../railgun-engine';

describe('RelayAdapt7702 registry address validation', () => {
const configured = '0x5bf5b11053e734690269C6B9D438F8C9d48F528A';

it('matches when the registry reports the same address (case-insensitive)', () => {
expect(
RailgunEngine.relayAdapt7702AddressMatchesRegistry(configured.toLowerCase(), configured),
).to.equal(true);
});

it('treats an absent or zero registry entry as unconfirmed (no block)', () => {
expect(RailgunEngine.relayAdapt7702AddressMatchesRegistry(undefined, configured)).to.equal(
true,
);
expect(
RailgunEngine.relayAdapt7702AddressMatchesRegistry(`0x${'0'.repeat(40)}`, configured),
).to.equal(true);
});

it('flags a concrete mismatch (a wrong delegate must block)', () => {
expect(
RailgunEngine.relayAdapt7702AddressMatchesRegistry(`0x${'1'.repeat(40)}`, configured),
).to.equal(false);
});
});
346 changes: 346 additions & 0 deletions src/abi/V2/Registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "string",
"name": "name",
"type": "string"
},
{
"indexed": true,
"internalType": "address",
"name": "contractAddress",
"type": "address"
}
],
"name": "ContractDeprecated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "string",
"name": "name",
"type": "string"
},
{
"indexed": true,
"internalType": "address",
"name": "contractAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "version",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bool",
"name": "deprecated",
"type": "bool"
}
],
"name": "ContractSet",
"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": true,
"internalType": "address",
"name": "deployment",
"type": "address"
}
],
"name": "Registered",
"type": "event"
},
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "deprecateContract",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getAllContracts",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
},
{
"internalType": "uint256",
"name": "version",
"type": "uint256"
},
{
"internalType": "bool",
"name": "deprecated",
"type": "bool"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "uint256",
"name": "nameIndex",
"type": "uint256"
}
],
"internalType": "struct Registry.RegistryEntry[]",
"name": "",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "getContract",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
},
{
"internalType": "uint256",
"name": "version",
"type": "uint256"
},
{
"internalType": "bool",
"name": "deprecated",
"type": "bool"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "uint256",
"name": "nameIndex",
"type": "uint256"
}
],
"internalType": "struct Registry.RegistryEntry",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "getContractAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "isDeployed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "nameIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "registryIndex",
"outputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
},
{
"internalType": "uint256",
"name": "version",
"type": "uint256"
},
{
"internalType": "bool",
"name": "deprecated",
"type": "bool"
},
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "uint256",
"name": "nameIndex",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "name",
"type": "string"
},
{
"internalType": "address",
"name": "contractAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "version",
"type": "uint256"
}
],
"name": "setContract",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading
Loading