Skip to content

Commit

Permalink
chore: revert changes to add back txRoot
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <[email protected]>
  • Loading branch information
JDawg287 committed Aug 22, 2023
1 parent 7f5050e commit 8dadb25
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions contracts/interfaces/IToposCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface IToposCore {
CertificateId prevId;
SubnetId sourceSubnetId;
bytes32 stateRoot;
bytes32 txRoot;
bytes32 receiptRoot;
SubnetId[] targetSubnets;
uint32 verifier;
Expand Down
4 changes: 3 additions & 1 deletion contracts/topos-core/ToposCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ contract ToposCore is IToposCore, AdminMultisigBase, Initializable {
CertificateId prevId,
SubnetId sourceSubnetId,
bytes32 stateRoot,
bytes32 txRoot,
bytes32 receiptRoot,
SubnetId[] memory targetSubnets,
uint32 verifier,
Expand All @@ -70,14 +71,15 @@ contract ToposCore is IToposCore, AdminMultisigBase, Initializable {
bytes memory signature
) = abi.decode(
certBytes,
(CertificateId, SubnetId, bytes32, bytes32, SubnetId[], uint32, CertificateId, bytes, bytes)
(CertificateId, SubnetId, bytes32, bytes32, bytes32, SubnetId[], uint32, CertificateId, bytes, bytes)
);

certificateSet.insert(CertificateId.unwrap(certId)); // add certificate ID to the CRUD storage set
Certificate storage newCert = certificates[certId];
newCert.prevId = prevId;
newCert.sourceSubnetId = sourceSubnetId;
newCert.stateRoot = stateRoot;
newCert.txRoot = txRoot;
newCert.receiptRoot = receiptRoot;
newCert.targetSubnets = targetSubnets;
newCert.verifier = verifier;
Expand Down
4 changes: 4 additions & 0 deletions test/topos-core/ToposCore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('ToposCore', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
cc.RECEIPT_ROOT_MAX,
[cc.TARGET_SUBNET_ID_4, cc.TARGET_SUBNET_ID_5],
cc.VERIFIER,
Expand Down Expand Up @@ -141,6 +142,7 @@ describe('ToposCore', () => {
cc.PREV_CERT_ID_0,
checkpoint[2].toString(),
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
cc.RECEIPT_ROOT_MAX,
[cc.TARGET_SUBNET_ID_4],
cc.VERIFIER,
Expand Down Expand Up @@ -175,6 +177,7 @@ describe('ToposCore', () => {
cc.PREV_CERT_ID_0,
checkpoint[2].toString(),
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
cc.RECEIPT_ROOT_MAX,
[cc.TARGET_SUBNET_ID_4],
cc.VERIFIER,
Expand All @@ -201,6 +204,7 @@ describe('ToposCore', () => {
cc.PREV_CERT_ID_0,
updatedTestCheckpoint[2].toString(),
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
cc.RECEIPT_ROOT_MAX,
[cc.TARGET_SUBNET_ID_4],
cc.VERIFIER,
Expand Down
11 changes: 11 additions & 0 deletions test/topos-core/ToposMessaging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
cc.RECEIPT_ROOT_MAX,
[cc.TARGET_SUBNET_ID_4, cc.TARGET_SUBNET_ID_5],
cc.VERIFIER,
Expand Down Expand Up @@ -261,6 +262,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
receiptsRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -333,6 +335,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
receiptsRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -373,6 +376,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
receiptsRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -403,6 +407,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
txc.INVALID_STATUS_TRANSACTION.receiptRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -446,6 +451,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
receiptsRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -481,6 +487,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
receiptsRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand All @@ -503,6 +510,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
txc.UNKNOWN_TOKEN_TRANSACTION.receiptRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -530,6 +538,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
txc.MINT_EXCEED_TRANSACTION.receiptRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -557,6 +566,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
txc.ZERO_ADDRESS_TRANSACTION.receiptRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down Expand Up @@ -595,6 +605,7 @@ describe('ToposMessaging', () => {
cc.PREV_CERT_ID_0,
cc.SOURCE_SUBNET_ID_1,
cc.STATE_ROOT_MAX,
cc.TX_ROOT_MAX,
receiptsRoot,
[cc.SOURCE_SUBNET_ID_2],
cc.VERIFIER,
Expand Down
4 changes: 3 additions & 1 deletion test/topos-core/shared/constants/certificates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const DUMMY_STARK_PROOF = ethers.utils.formatBytes32String('starkProof')
export const DUMMY_SIGNATURE = ethers.utils.formatBytes32String('signature')
export const PREV_CERT_ID_0 =
'0x0000000000000000000000000000000000000000000000000000000000000000'
export const RECEIPT_ROOT_MAX =
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
export const SOURCE_SUBNET_ID_1 =
'0x0000000000000000000000000000000000000000000000000000000000000001'
export const SOURCE_SUBNET_ID_2 =
Expand All @@ -30,6 +32,6 @@ export const TARGET_SUBNET_ID_5 =
'0x0000000000000000000000000000000000000000000000000000000000000005'
export const TARGET_SUBNET_ID_6 =
'0x0000000000000000000000000000000000000000000000000000000000000006'
export const RECEIPT_ROOT_MAX =
export const TX_ROOT_MAX =
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'
export const VERIFIER = 1
3 changes: 3 additions & 0 deletions test/topos-core/shared/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function encodeCertParam(
prevId: string,
sourceSubnetId: string,
stateRoot: string,
txRoot: string,
receiptRoot: string,
targetSubnets: string[],
verifier: number,
Expand All @@ -17,6 +18,7 @@ function encodeCertParam(
'bytes32',
'bytes32',
'bytes32',
'bytes32',
'bytes32[]',
'uint32',
'bytes32',
Expand All @@ -27,6 +29,7 @@ function encodeCertParam(
prevId,
sourceSubnetId,
stateRoot,
txRoot,
receiptRoot,
targetSubnets,
verifier,
Expand Down

0 comments on commit 8dadb25

Please sign in to comment.