From 3e9951f1d3996a9f81aaf755219714859bb1691b Mon Sep 17 00:00:00 2001 From: JSHan94 Date: Wed, 13 Mar 2024 14:00:57 +0900 Subject: [PATCH] register base denom and fix claim response --- bots/package-lock.json | 135 ++++++++++++-------- bots/package.json | 2 +- bots/src/sawgger/executor_model.ts | 2 +- bots/src/service/executor/ClaimTxService.ts | 4 +- bots/src/worker/bridgeExecutor/L1Monitor.ts | 1 + 5 files changed, 86 insertions(+), 58 deletions(-) diff --git a/bots/package-lock.json b/bots/package-lock.json index 0ade2c3c..36ec955c 100644 --- a/bots/package-lock.json +++ b/bots/package-lock.json @@ -50,7 +50,7 @@ "zlib": "^1.0.5" }, "devDependencies": { - "@initia/initia.js": "^0.1.27", + "@initia/initia.js": "^0.1.33", "@koa/cors": "^4.0.0", "@sentry/node": "^7.91.0", "@testcontainers/postgresql": "^10.4.0", @@ -933,18 +933,33 @@ "google-protobuf": "^3.14.0" } }, + "node_modules/@initia/builder.js": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@initia/builder.js/-/builder.js-0.1.3.tgz", + "integrity": "sha512-2FG5ifz7Nc8DLEZJ3jA+1NC7xH5bY6FJ2fB5tDqkUsy1rZtpvwwk9AF1tif4V/yI9fp+DIuSjAwn9aPANdFb8g==", + "dev": true, + "dependencies": { + "ffi-napi": "^4.0.3", + "ref-napi": "^3.0.3", + "ref-struct-di": "^1.1.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@initia/initia.js": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/@initia/initia.js/-/initia.js-0.1.27.tgz", - "integrity": "sha512-HLo3NjenWdFiJH8BjEAU+eEMJ+WGWOYf+n1bxMNH7n7qPTx5pJUWwIXFEMrgQQwDsgWSl4oijZoceJ6rFZhynQ==", + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/@initia/initia.js/-/initia.js-0.1.35.tgz", + "integrity": "sha512-7Kdmw9UpEDXJCNwpuI5PoYJBwG5ls71t9MM8SWTU+5ELhQr2gl63Lf8IuySHRizm/3j4HwB4wV5vhQRT58P7Nw==", "dev": true, "dependencies": { - "@initia/initia.proto": "^0.1.23", - "@initia/opinit.proto": "^0.0.2", + "@initia/builder.js": "^0.1.3", + "@initia/initia.proto": "^0.1.27", + "@initia/opinit.proto": "^0.0.3", "@ledgerhq/hw-transport": "^6.27.12", "@ledgerhq/hw-transport-webhid": "^6.27.12", "@ledgerhq/hw-transport-webusb": "^6.27.12", - "@mysten/bcs": "^0.8.1", + "@mysten/bcs": "^0.10.1", "axios": "^1.6.5", "bech32": "^2.0.0", "bignumber.js": "^9.1.0", @@ -954,7 +969,7 @@ "keccak256": "^1.0.6", "long": "^5.2.0", "ripemd160": "^2.0.2", - "secp256k1": "^4.0.3", + "secp256k1": "^5.0.0", "tmp": "^0.2.1", "ws": "^7.5.9" }, @@ -963,9 +978,9 @@ } }, "node_modules/@initia/initia.proto": { - "version": "0.1.23", - "resolved": "https://registry.npmjs.org/@initia/initia.proto/-/initia.proto-0.1.23.tgz", - "integrity": "sha512-g82tTHlaEmNMhcH3Fq619qndgfj0fP0WF6vVJw3UltqEmMwNbgotX4YWDE8f5wYcEr6Z+NC5B6Y676Ozt9gylw==", + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/@initia/initia.proto/-/initia.proto-0.1.27.tgz", + "integrity": "sha512-GIjISGNnKQumGV6M0cswlIyJUEFLJwR+OW/YfcMr/AOgtnSh0f+obret895lKVfvZFhXoJtydBtV+gDr9n/73g==", "dev": true, "dependencies": { "@improbable-eng/grpc-web": "^0.15.0", @@ -975,9 +990,9 @@ } }, "node_modules/@initia/opinit.proto": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@initia/opinit.proto/-/opinit.proto-0.0.2.tgz", - "integrity": "sha512-uUd00KNJXwJbWW3umfZL91HJAHGyOs5ZcwPlQEfdSCryyuT2hlvC+6NFLa+b8V01Ed0NNeKm44Zmc4kkBfcFzg==", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@initia/opinit.proto/-/opinit.proto-0.0.3.tgz", + "integrity": "sha512-JDZz9124Y+WvjTl+jXQgq0CczqGwbaxSEsyfo/Gt/7wbh34GWbhZhKFiAzD8ABTLT3NIxxfw0BBlXOKHj2xfVw==", "dev": true, "dependencies": { "@improbable-eng/grpc-web": "^0.15.0", @@ -1851,9 +1866,9 @@ "dev": true }, "node_modules/@mysten/bcs": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.8.1.tgz", - "integrity": "sha512-wSEdP7QEfGQdb34g+7R0f3OdRqrv88iIABfJVDVJ6IsGLYVILreh8dZfNpZNUUyzctiyhX7zB9e/lR5qkddFPA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.10.1.tgz", + "integrity": "sha512-cQDb7Rhz2J82ZqgVQiHykuwKUlgiLWS2bjoajPPW0uvXlb75qrgKuaxh1UzsaRhHy3egk/APc0xjiZoqdbzB4w==", "dev": true, "dependencies": { "bs58": "^5.0.0" @@ -13544,9 +13559,9 @@ } }, "node_modules/protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "version": "7.2.6", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", + "integrity": "sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -14418,24 +14433,24 @@ } }, "node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-5.0.0.tgz", + "integrity": "sha512-TKWX8xvoGHrxVdqbYeZM9w+izTF4b9z3NhSaDkdn81btvuh+ivbIMGT/zQvDtTFWhRlThpoz6LEYTr7n8A5GcA==", "dev": true, "hasInstallScript": true, "dependencies": { "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", + "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.0.0" } }, "node_modules/secp256k1/node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", "dev": true }, "node_modules/semver": { @@ -18894,18 +18909,30 @@ "browser-headers": "^0.4.1" } }, + "@initia/builder.js": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@initia/builder.js/-/builder.js-0.1.3.tgz", + "integrity": "sha512-2FG5ifz7Nc8DLEZJ3jA+1NC7xH5bY6FJ2fB5tDqkUsy1rZtpvwwk9AF1tif4V/yI9fp+DIuSjAwn9aPANdFb8g==", + "dev": true, + "requires": { + "ffi-napi": "^4.0.3", + "ref-napi": "^3.0.3", + "ref-struct-di": "^1.1.1" + } + }, "@initia/initia.js": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/@initia/initia.js/-/initia.js-0.1.27.tgz", - "integrity": "sha512-HLo3NjenWdFiJH8BjEAU+eEMJ+WGWOYf+n1bxMNH7n7qPTx5pJUWwIXFEMrgQQwDsgWSl4oijZoceJ6rFZhynQ==", + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/@initia/initia.js/-/initia.js-0.1.35.tgz", + "integrity": "sha512-7Kdmw9UpEDXJCNwpuI5PoYJBwG5ls71t9MM8SWTU+5ELhQr2gl63Lf8IuySHRizm/3j4HwB4wV5vhQRT58P7Nw==", "dev": true, "requires": { - "@initia/initia.proto": "^0.1.23", - "@initia/opinit.proto": "^0.0.2", + "@initia/builder.js": "^0.1.3", + "@initia/initia.proto": "^0.1.27", + "@initia/opinit.proto": "^0.0.3", "@ledgerhq/hw-transport": "^6.27.12", "@ledgerhq/hw-transport-webhid": "^6.27.12", "@ledgerhq/hw-transport-webusb": "^6.27.12", - "@mysten/bcs": "^0.8.1", + "@mysten/bcs": "^0.10.1", "axios": "^1.6.5", "bech32": "^2.0.0", "bignumber.js": "^9.1.0", @@ -18915,15 +18942,15 @@ "keccak256": "^1.0.6", "long": "^5.2.0", "ripemd160": "^2.0.2", - "secp256k1": "^4.0.3", + "secp256k1": "^5.0.0", "tmp": "^0.2.1", "ws": "^7.5.9" } }, "@initia/initia.proto": { - "version": "0.1.23", - "resolved": "https://registry.npmjs.org/@initia/initia.proto/-/initia.proto-0.1.23.tgz", - "integrity": "sha512-g82tTHlaEmNMhcH3Fq619qndgfj0fP0WF6vVJw3UltqEmMwNbgotX4YWDE8f5wYcEr6Z+NC5B6Y676Ozt9gylw==", + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/@initia/initia.proto/-/initia.proto-0.1.27.tgz", + "integrity": "sha512-GIjISGNnKQumGV6M0cswlIyJUEFLJwR+OW/YfcMr/AOgtnSh0f+obret895lKVfvZFhXoJtydBtV+gDr9n/73g==", "dev": true, "requires": { "@improbable-eng/grpc-web": "^0.15.0", @@ -18933,9 +18960,9 @@ } }, "@initia/opinit.proto": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/@initia/opinit.proto/-/opinit.proto-0.0.2.tgz", - "integrity": "sha512-uUd00KNJXwJbWW3umfZL91HJAHGyOs5ZcwPlQEfdSCryyuT2hlvC+6NFLa+b8V01Ed0NNeKm44Zmc4kkBfcFzg==", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@initia/opinit.proto/-/opinit.proto-0.0.3.tgz", + "integrity": "sha512-JDZz9124Y+WvjTl+jXQgq0CczqGwbaxSEsyfo/Gt/7wbh34GWbhZhKFiAzD8ABTLT3NIxxfw0BBlXOKHj2xfVw==", "dev": true, "requires": { "@improbable-eng/grpc-web": "^0.15.0", @@ -19626,9 +19653,9 @@ "dev": true }, "@mysten/bcs": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.8.1.tgz", - "integrity": "sha512-wSEdP7QEfGQdb34g+7R0f3OdRqrv88iIABfJVDVJ6IsGLYVILreh8dZfNpZNUUyzctiyhX7zB9e/lR5qkddFPA==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.10.1.tgz", + "integrity": "sha512-cQDb7Rhz2J82ZqgVQiHykuwKUlgiLWS2bjoajPPW0uvXlb75qrgKuaxh1UzsaRhHy3egk/APc0xjiZoqdbzB4w==", "dev": true, "requires": { "bs58": "^5.0.0" @@ -28901,9 +28928,9 @@ } }, "protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "version": "7.2.6", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", + "integrity": "sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==", "dev": true, "requires": { "@protobufjs/aspromise": "^1.1.2", @@ -29596,20 +29623,20 @@ } }, "secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-5.0.0.tgz", + "integrity": "sha512-TKWX8xvoGHrxVdqbYeZM9w+izTF4b9z3NhSaDkdn81btvuh+ivbIMGT/zQvDtTFWhRlThpoz6LEYTr7n8A5GcA==", "dev": true, "requires": { "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", + "node-addon-api": "^5.0.0", "node-gyp-build": "^4.2.0" }, "dependencies": { "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", "dev": true } } diff --git a/bots/package.json b/bots/package.json index 64ffe46e..440ca425 100644 --- a/bots/package.json +++ b/bots/package.json @@ -44,7 +44,7 @@ }, "homepage": "https://github.com/initia-labs/batch-submitter#readme", "devDependencies": { - "@initia/initia.js": "^0.1.27", + "@initia/initia.js": "^0.1.33", "@koa/cors": "^4.0.0", "@sentry/node": "^7.91.0", "@testcontainers/postgresql": "^10.4.0", diff --git a/bots/src/sawgger/executor_model.ts b/bots/src/sawgger/executor_model.ts index 57a57df3..0ab165c7 100644 --- a/bots/src/sawgger/executor_model.ts +++ b/bots/src/sawgger/executor_model.ts @@ -44,7 +44,7 @@ const ClaimStruct = z.object({ l_2_denom: z.string(), version: z.string(), state_root: z.string(), - storage_root: z.string(), + merkle_root: z.string(), last_block_hash: z.string(), }) diff --git a/bots/src/service/executor/ClaimTxService.ts b/bots/src/service/executor/ClaimTxService.ts index 43ff2754..772abca4 100644 --- a/bots/src/service/executor/ClaimTxService.ts +++ b/bots/src/service/executor/ClaimTxService.ts @@ -17,7 +17,7 @@ interface ClaimTx { l2Denom: string version: string stateRoot: string - storageRoot: string + merkleRoot: string lastBlockHash: string } @@ -86,7 +86,7 @@ export async function getClaimTxList( l2Denom: withdrawalTx.l2Denom, version: sha3_256(withdrawalTx.outputIndex).toString('base64'), stateRoot: output.stateRoot, - storageRoot: output.merkleRoot, + merkleRoot: output.merkleRoot, lastBlockHash: output.lastBlockHash, } claimTxList.push(claimData) diff --git a/bots/src/worker/bridgeExecutor/L1Monitor.ts b/bots/src/worker/bridgeExecutor/L1Monitor.ts index bd503388..57ed55b1 100644 --- a/bots/src/worker/bridgeExecutor/L1Monitor.ts +++ b/bots/src/worker/bridgeExecutor/L1Monitor.ts @@ -61,6 +61,7 @@ export class L1Monitor extends Monitor { new Coin(data['l2_denom'], data['amount']), parseInt(data['l1_sequence']), this.currentHeight, + data['l1_denom'], Buffer.from(data['data'], 'hex').toString('base64') ) ];