-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
questionFurther information is requestedFurther information is requested
Description
General Question
我想要依照document体验一下EVM环境下跨链数据传输的功能。
为此我修改了 /bitxhub/scripts/deploy_contracts.sh 以部署demo中的合约(内容附在后面)。
执行结果是“error="failed to estimate gas needed: execution reverted""
似乎是跨链获取和回写失败了。请问跨链获取的接口 和跨链回写的接口应该如何修改,以及是否有更新更全的文档
环境
系统: Ubuntu 22.04.3 LTS
go版本:go1.21.5 linux/amd64
solidity编译器版本:0.7.6+commit.7338295f.Linux.g++
代码版本:V2.8.0
网络:基于godock playground start启动的双链网络
demo_swapper.sol合约
pragma solidity >=0.5.6;
pragma experimental ABIEncoderV2;
contract DataSwapper {
mapping(string => string) dataM; // map for accounts
// change the address of Broker accordingly
address BrokerAddr;
// AccessControl
modifier onlyBroker() {
require(msg.sender == BrokerAddr, "Invoker are not the Broker");
_;
}
constructor(address _brokerAddr, bool _ordered) {
BrokerAddr = _brokerAddr;
Broker(BrokerAddr).register(_ordered);
}
function register(bool _ordered) public {
Broker(BrokerAddr).register(_ordered);
}
// 数据交换类的业务合约
function getData(string memory key) public view returns (string memory) {
return dataM[key];
}
function set(string memory key, string memory value) public {
dataM[key] = value;
}
function get(string memory destChainServiceID, string memory key) public {
bytes[] memory args = new bytes[](2);
args[0] = abi.encodePacked(uint64(0)); // 是否含有多跨链请求
args[1] = abi.encodePacked(key);
bytes[] memory argsCb = new bytes[](1);
argsCb[0] = abi.encodePacked(key);
Broker(BrokerAddr).emitInterchainEvent(destChainServiceID, "interchainGet", args, "interchainSet", argsCb, "", new bytes[](0), false,new string[](0));
}
function interchainGet(bytes[] memory args, bool isRollback) public onlyBroker returns(bytes[] memory) {
require(args.length == 1, "interchainGet args' length is not correct, expect 1");
string memory key = string(args[0]);
bytes[] memory result = new bytes[](1);
result[0] = abi.encodePacked(dataM[key]);
return result;
}
function interchainSet(bytes[] memory args) public onlyBroker {
require(args.length == 2, "interchainSet args' length is not correct, expect 2");
string memory key = string(args[0]);
string memory value = string(args[1]);
set(key, value);
}
}
abstract contract Broker {
function emitInterchainEvent(
string memory destFullServiceID,
string memory func,
bytes[] memory args,
string memory funcCb,
bytes[] memory argsCb,
string memory funcRb,
bytes[] memory argsRb,
bool isEncrypt,
string[] memory group
) public virtual;
function register(bool ordered) public virtual;
}
测试命令1
print_blue "3. set other data"
goduck ether contract invoke \
--key-path ./docker/quick_start/account.key --abi-path ./example/demo_swapper.abi \
--address http://localhost:8547 \
0xb00AC45963879cb9118d13120513585873f81Cdb set Bob^111
sleep 3
测试结果1
ethereum-2 | INFO [12-19|06:43:56.454] Submitted transaction fullhash=0x3cf0a4f3f3129f1468b2a8a45315a1fdb77dba9078540dcab512f25b421497e0 recipient=0xb00AC45963879cb9118d13120513585873f81Cdb
ethereum-2 | INFO [12-19|06:43:56.455] Commit new mining work number=13 sealhash="9685c3…75e550" uncles=0 txs=1 gas=44571 fees=4.4571e-14 elapsed="655.774µs"
ethereum-2 | INFO [12-19|06:43:56.456] Successfully sealed new block number=13 sealhash="9685c3…75e550" hash="3b3cde…c6e666" elapsed="959.14µs"
ethereum-2 | INFO [12-19|06:43:56.456] 🔨 mined potential block number=13 hash="3b3cde…c6e666"
ethereum-2 | INFO [12-19|06:43:56.457] Commit new mining work number=14 sealhash="0a2866…3684f0" uncles=0 txs=0 gas=0 fees=0 elapsed="655.994µs"
ethereum-2 | INFO [12-19|06:43:56.457] Sealing paused, waiting for transactions
测试命令2
print_blue "4. other get data"
goduck ether contract invoke \
--key-path ./docker/quick_start/account.key --abi-path ./example/demo_swapper.abi \
--address http://localhost:8545 \
0xb00AC45963879cb9118d13120513585873f81Cdb get 1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb^Bob
测试结果2
ethereum-1 | INFO [12-19|06:44:01.572] Commit new mining work number=13 sealhash="ff7bca…62809e" uncles=0 txs=1 gas=418147 fees=4.18147e-13 elapsed=3.850ms
ethereum-1 | INFO [12-19|06:44:01.573] Successfully sealed new block number=13 sealhash="ff7bca…62809e" hash="82a7a8…54522b" elapsed=1.052ms
ethereum-1 | INFO [12-19|06:44:01.573] 🔨 mined potential block number=13 hash="82a7a8…54522b"
ethereum-1 | INFO [12-19|06:44:01.574] Commit new mining work number=14 sealhash="aa2609…a4c870" uncles=0 txs=0 gas=0 fees=0 elapsed="581.258µs"
ethereum-1 | INFO [12-19|06:44:01.574] Sealing paused, waiting for transactions
pier-ethereum1 | time="2023-12-19T06:44:01.575" level=info msg="[step1] Receive ibtp from plugin" id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" index=1 module=exchanger timestamp=0 typ=INTERCHAIN
pier-ethereum1 | time="2023-12-19T06:44:01.575" level=info msg="Receive ibtp from :appchain:ethappchain1" ibtp_id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" index=1 module=exchanger type=INTERCHAIN
bitxhub_solo | time="2023-12-19T06:44:01.982" level=info msg="======== Call execute, height=11" module=order
bitxhub_solo | time="2023-12-19T06:44:01.983" level=info msg="Generated block" count=1 height=11 module=app
bitxhub_solo | time="2023-12-19T06:44:01.983" level=info msg="verify proof elapsed" count=1 fields.time="229.934µs" module=executor type=serial
bitxhub_solo | time="2023-12-19T06:44:01.984" level=info msg="Apply transactions elapsed" count=1 fields.time="529.651µs" module=executor
bitxhub_solo | time="2023-12-19T06:44:01.985" level=info msg="Persisted block" count=1 elapse="493.935µs" hash=0x26E0BD5B92EB464Db444BD644f9146778FA8dED4eb3A9741D23e8E4Dc6b451d4 height=11 module=executor
bitxhub_solo | time="2023-12-19T06:44:01.985" level=info msg="Executed and Persisted block" count=1 elapse=1.936438ms height=11 module=executor
bitxhub_solo | time="2023-12-19T06:44:01.985" level=info msg="classify block" count=1 elapse="18.079µs" height=11 module=router
bitxhub_solo | time="2023-12-19T06:44:01.985" level=info msg="end send block to pier" count=1 elapse="175.166µs" height=11 module=router
pier-ethereum1 | time="2023-12-19T06:44:01.985" level=info msg="[4] Handle interchain tx wrapper" count=0 elapse="4.268µs" height=11 index=0 module=bxh_adapter multi IDs="[]" timeout IDs="[]"
pier-ethereum2 | time="2023-12-19T06:44:01.985" level=info msg="[3] receive ibtp from bxh" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" height=11 index=1 module=bxh_adapter
pier-ethereum2 | time="2023-12-19T06:44:01.985" level=info msg="Sync IBTP from bitxhub" ibtp_id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" module=bxh_adapter type=INTERCHAIN
pier-ethereum2 | time="2023-12-19T06:44:01.985" level=info msg="[4] Handle interchain tx wrapper" count=1 elapse="243.76µs" height=11 index=0 module=bxh_adapter multi IDs="[]" timeout IDs="[]"
bitxhub_solo | time="2023-12-19T06:44:01.991" level=info msg="Bxh transaction" gasUsed=210000 module=executor
pier-ethereum2 | time="2023-12-19T06:44:01.991" level=info msg="[3.1] receive multi sign" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" elapse=5.872947ms index=1 module=bxh_adapter
pier-ethereum2 | time="2023-12-19T06:44:01.992" level=info msg="[3.2.1] start insert pool" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" current index=1 elapse="14.098µs" index=1 key="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-REQUEST" module=bxh_adapter
pier-ethereum2 | time="2023-12-19T06:44:01.992" level=info msg="[3.2] end insert pool" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" elapse="132.909µs" index=1 module=bxh_adapter
pier-ethereum2 | time="2023-12-19T06:44:01.992" level=info msg="[step5] Receive ibtp from :bitxhub:1356" ibtp_id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" index=1 module=exchanger timestamp=1702968241992445821 type=INTERCHAIN
pier-ethereum2 | time="2023-12-19T06:44:01.992" level=info msg="start submit ibtp" ibtp="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" module=appchain_adapter typ=INTERCHAIN
ethereum-2 | INFO [12-19|06:44:02.070] Submitted transaction fullhash=0xf99108f2da16241fd78f05829bf9c28ee613a032c4e11205e0fdcaf1fa97d082 recipient=0x30c5D3aeb4681af4D13384DBc2a717C51cb1cc11
ethereum-2 | INFO [12-19|06:44:02.075] Commit new mining work number=14 sealhash="b25408…d3f5c6" uncles=0 txs=1 gas=469047 fees=4.69047e-13 elapsed=4.401ms
ethereum-2 | INFO [12-19|06:44:02.076] Successfully sealed new block number=14 sealhash="b25408…d3f5c6" hash="9c8690…5e4294" elapsed="979.572µs"
ethereum-2 | INFO [12-19|06:44:02.076] 🔨 mined potential block number=14 hash="9c8690…5e4294"
ethereum-2 | INFO [12-19|06:44:02.077] Commit new mining work number=15 sealhash="fac3e5…5c5963" uncles=0 txs=0 gas=0 fees=0 elapsed="765.973µs"
ethereum-2 | INFO [12-19|06:44:02.077] Sealing paused, waiting for transactions
pier-ethereum2 | time="2023-12-19T06:44:02.077" level=info msg="[step1] Receive ibtp from plugin" id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" index=1 module=exchanger timestamp=0 typ=RECEIPT_SUCCESS
pier-ethereum2 | time="2023-12-19T06:44:02.078" level=info msg="Receive ibtp from :appchain:ethappchain2" ibtp_id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" index=1 module=exchanger type=RECEIPT_SUCCESS
pier-ethereum1 | time="2023-12-19T06:44:02.085" level=info msg="[2.1] bxh Adapter send tx" elapse=509.637627ms index=1 module=bxh_adapter type=INTERCHAIN
bitxhub_solo | time="2023-12-19T06:44:02.283" level=info msg="======== Call execute, height=12" module=order
bitxhub_solo | time="2023-12-19T06:44:02.283" level=info msg="Generated block" count=1 height=12 module=app
bitxhub_solo | time="2023-12-19T06:44:02.283" level=info msg="verify proof elapsed" count=1 fields.time="223.461µs" module=executor type=serial
bitxhub_solo | time="2023-12-19T06:44:02.284" level=info msg="record invoke service" chainServiceID="ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb" fromChainServiceID="ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb" module=executor result=true
bitxhub_solo | time="2023-12-19T06:44:02.284" level=info msg="Apply transactions elapsed" count=1 fields.time=1.02943ms module=executor
bitxhub_solo | time="2023-12-19T06:44:02.285" level=info msg="Persisted block" count=1 elapse="489.435µs" hash=0xbd4EE33F42aF9a2b90c56c32409A98ceBc71da47DdCec92145dcc957Ee5a391C height=12 module=executor
bitxhub_solo | time="2023-12-19T06:44:02.285" level=info msg="Executed and Persisted block" count=1 elapse=2.555271ms height=12 module=executor
bitxhub_solo | time="2023-12-19T06:44:02.285" level=info msg="classify block" count=1 elapse="18.916µs" height=12 module=router
bitxhub_solo | time="2023-12-19T06:44:02.286" level=info msg="end send block to pier" count=1 elapse="206.565µs" height=12 module=router
pier-ethereum1 | time="2023-12-19T06:44:02.286" level=info msg="[3] receive ibtp from bxh" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" height=12 index=1 module=bxh_adapter
pier-ethereum1 | time="2023-12-19T06:44:02.286" level=info msg="Sync IBTP from bitxhub" ibtp_id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" module=bxh_adapter type=RECEIPT_SUCCESS
pier-ethereum1 | time="2023-12-19T06:44:02.286" level=info msg="[4] Handle interchain tx wrapper" count=1 elapse="114.783µs" height=12 index=0 module=bxh_adapter multi IDs="[]" timeout IDs="[]"
pier-ethereum2 | time="2023-12-19T06:44:02.286" level=info msg="[4] Handle interchain tx wrapper" count=0 elapse="4.116µs" height=12 index=0 module=bxh_adapter multi IDs="[]" timeout IDs="[]"
bitxhub_solo | time="2023-12-19T06:44:02.291" level=info msg="Bxh transaction" gasUsed=210000 module=executor
pier-ethereum1 | time="2023-12-19T06:44:02.292" level=info msg="[3.1] receive multi sign" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" elapse=5.51184ms index=1 module=bxh_adapter
pier-ethereum1 | time="2023-12-19T06:44:02.292" level=info msg="[3.2.1] start insert pool" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" current index=1 elapse="17.257µs" index=1 key="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-RESPONSE" module=bxh_adapter
pier-ethereum1 | time="2023-12-19T06:44:02.292" level=info msg="[3.2] end insert pool" ID="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" elapse="119.465µs" index=1 module=bxh_adapter
pier-ethereum1 | time="2023-12-19T06:44:02.292" level=info msg="[step5] Receive ibtp from :bitxhub:1356" ibtp_id="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" index=1 module=exchanger timestamp=1702968242292385468 type=RECEIPT_SUCCESS
pier-ethereum1 | time="2023-12-19T06:44:02.292" level=info msg="start submit receipt" ibtp="1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1" module=appchain_adapter typ=RECEIPT_SUCCESS
pier-ethereum2 | time="2023-12-19T06:44:02.587" level=info msg="[2.1] bxh Adapter send tx" elapse=508.009803ms index=1 module=bxh_adapter type=RECEIPT_SUCCESS
ethereum-1 | WARN [12-19|06:44:03.215] Served eth_estimateGas reqid=16 t=915.022706ms err="execution reverted"
pier-ethereum1 | 2023-12-19T06:44:03.216Z [DEBUG] plugin.sh: 2023-12-19T06:44:03.215Z [WARN] client: Call InvokeReceipt failed: srcAddr=0xb00AC45963879cb9118d13120513585873f81Cdb dstFullID=1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb index=1 reqType=1 result=111 txStatus=3 multiSign size=1 error="failed to estimate gas needed: execution reverted"
pier-ethereum1 | 2023-12-19T06:44:03.216Z [DEBUG] plugin.sh: 2023-12-19T06:44:03.216Z [WARN] client: result: 0=0x313131
pier-ethereum1 | 2023-12-19T06:44:03.216Z [DEBUG] plugin.sh: 2023-12-19T06:44:03.216Z [WARN] client: multiSign: 0=0xde30a68e057f65fce0a5b840d50a0ca5ff4b4b996b90a115e4c2463f57e5a646700e27af9125b5b7d2fdad9f76e8735021dd9bc62fd418414449d841d9858bd301
pier-ethereum1 | time="2023-12-19T06:44:03.216" level=info msg="appchain adapter submit receipt success" module=appchain_adapter
pier-ethereum1 | time="2023-12-19T06:44:03.216" level=error msg="send IBTP to Adapt:appchain:ethappchain1%!(EXTRA string=error, string=fail to send ibtp 1356:ethappchain1:0xb00AC45963879cb9118d13120513585873f81Cdb-1356:ethappchain2:0xb00AC45963879cb9118d13120513585873f81Cdb-1 with type RECEIPT_SUCCESS: failed to estimate gas needed: execution reverted)" module=exchanger
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested