Giter Site home page Giter Site logo

b2network / b2-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evmos/ethermint

3.0 3.0 7.0 34.39 MB

Ethermint is a Cosmos SDK library for running scalable and interoperable EVM chains

Home Page: https://docs.evmos.org/

License: GNU Lesser General Public License v3.0

Shell 1.77% JavaScript 5.32% Python 6.03% Go 77.92% TypeScript 0.02% Nix 0.65% Makefile 0.77% Batchfile 0.12% Dockerfile 0.06% Solidity 7.16% Jsonnet 0.16%

b2-node's People

Stargazers

 avatar  avatar  avatar

b2-node's Issues

Semgrep action Get Diff step Failure

https://github.com/b2network/b2-node/actions/runs/6717292590/job/18254897390

git remote add get-diff-action
  >> fatal: detected dubious ownership in repository at '/__w/b2-node/b2-node'
  >> To add an exception for this directory, call:
  >> 
  >> 	git config --global --add safe.directory /__w/b2-node/b2-node
git fetch --no-tags --no-recurse-submodules '--depth=10000' get-diff-action 'refs/pull/6/merge:refs/remotes/get-diff-action/pull/6/merge' 'refs/heads/main:refs/remotes/get-diff-action/main'
  >> fatal: detected dubious ownership in repository at '/__w/b2-node/b2-node'
  >> To add an exception for this directory, call:
  >> 
  >> 	git config --global --add safe.directory /__w/b2-node/b2-node
git diff 'get-diff-action/main...get-diff-action/pull/6/merge' '--diff-filter=AMRC' --name-only
Warning:   >> warning: Not a git repository. Use --no-index to compare two paths outside a working t

need change ethermint -> b2-node

run: git config --global --add safe.directory /__w/ethermint/ethermint

Go vulnerability check failed

Dependency Review actions failed

https://github.com/oxf71/b2-node/actions/runs/6730778725/job/18294194448

Run make vulncheck
Makefile:81: RocksDB support is disabled; to build and test with RocksDB support, set ENABLE_ROCKSDB=true
fatal: No names found, cannot describe anything.
mkdir -p /home/runner/work/b2-node/b2-node/build/
GOBIN=/home/runner/work/b2-node/b2-node/build go install golang.org/x/vuln/cmd/govulncheck@latest
go: downloading golang.org/x/vuln v1.0.1
go: downloading golang.org/x/mod v0.12.0
go: downloading golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846
go: downloading golang.org/x/sys v0.11.0
go: downloading golang.org/x/sync v0.3.0
/home/runner/work/b2-node/b2-node/build/govulncheck ./...
Scanning your code and 1126 packages across 159 dependent modules for known vulnerabilities...

Vulnerability #1: GO-2023-2153
    denial of service from HTTP/2 Rapid Reset in google.golang.org/grpc
  More info: https://pkg.go.dev/vuln/GO-2023-2153
  Module: google.golang.org/grpc
    Found in: google.golang.org/[email protected]
    Fixed in: google.golang.org/[email protected]
    Example traces found:
Error:       #1: testutil/network/util.go:126:45: network.startInProcess calls grpc.StartGRPCServer, which eventually calls transport.NewServerTransport
Error:       #2: testutil/network/util.go:126:45: network.startInProcess calls grpc.StartGRPCServer, which calls grpc.NewServer
Error:       #3: testutil/network/util.go:126:45: network.startInProcess calls grpc.StartGRPCServer, which eventually calls grpc.Server.Serve

Vulnerability #2: GO-2023-2102
    HTTP/2 rapid reset can cause excessive work in net/http
  More info: https://pkg.go.dev/vuln/GO-2023-2102
  Standard library
    Found in: net/[email protected]
    Fixed in: net/[email protected]
    Example traces found:
Error:       #1: rpc/websockets.go:114:29: rpc.Start calls http.ListenAndServe
Error:       #2: rpc/websockets.go:116:32: rpc.Start calls http.ListenAndServeTLS
Error:       #3: testutil/network/util.go:134:46: network.startInProcess calls grpc.StartGRPCWeb, which eventually calls http.Server.ListenAndServe
Error:       #4: server/json_rpc.go:103:26: server.StartJSONRPC calls http.Server.Serve
Error:       #5: testutil/network/util.go:82:24: network.startInProcess calls service.BaseService.Start, which eventually calls http.Server.ServeTLS

Vulnerability #3: GO-2023-2043
    Improper handling of special tags within script contexts in html/template
  More info: https://pkg.go.dev/vuln/GO-2023-2043

How handle vulnerability check results?

parse brc20 transaction

brc-20 deply

testnet:
txid: e37b99864a4551488412308eb60ef851d2714710f2210fc1c359f457e052cad4

tx information: https://testnet.unisat.io/inscription/e37b99864a4551488412308eb60ef851d2714710f2210fc1c359f457e052cad4i0

raw hex:

0200000000010149930903299e0f6ba40af357e0c5802761d22012a771677f9010f7d71f0d2e4f0000000000fdffffff022202000000000000160014b6e22a1a7c7ddbb441b584e78b2ee7a00a7e94af0005000000000000160014bdfd6e0e889ce57c9adbfe817b269786ca0821d30340e0215897b2bff810a2959f4a7db6f1a38186ea0ce1cab3ec75d59c3f570c54e4313c7aa6a0e2f49198eb6029c150a1ad26fa1647c34d573f3e6d0c6f2feea7248b20cdf90cd799e54fd02e2dfb4fdedfc8292b19ed59bd5c3a657c3c4174e192b35bac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800457b2270223a226272632d3230222c226f70223a226465706c6f79222c227469636b223a224a4f4558222c226d6178223a223231303030303030222c226c696d223a2231227d6821c11cfa4749cb6996d5133dde5157c9dca2941948cf749fd313ad414b06791f67ad00000000

witness:

witness index 0:  e0215897b2bff810a2959f4a7db6f1a38186ea0ce1cab3ec75d59c3f570c54e4313c7aa6a0e2f49198eb6029c150a1ad26fa1647c34d573f3e6d0c6f2feea724
witness index 1:  20cdf90cd799e54fd02e2dfb4fdedfc8292b19ed59bd5c3a657c3c4174e192b35bac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800457b2270223a226272632d3230222c226f70223a226465706c6f79222c227469636b223a224a4f4558222c226d6178223a223231303030303030222c226c696d223a2231227d68
witness index 2:  c11cfa4749cb6996d5133dde5157c9dca2941948cf749fd313ad414b06791f67ad

inner_witnessscript_asm:

OP_PUSHBYTES_32 cdf90cd799e54fd02e2dfb4fdedfc8292b19ed59bd5c3a657c3c4174e192b35b 
OP_CHECKSIG 
OP_0 
OP_IF 
OP_PUSHBYTES_3 6f7264 
OP_PUSHBYTES_1 01 
OP_PUSHBYTES_24 746578742f706c61696e3b636861727365743d7574662d38 
OP_0 
OP_PUSHBYTES_69 7b2270223a226272632d3230222c226f70223a226465706c6f79222c227469636b223a224a4f4558222c226d6178223a223231303030303030222c226c696d223a2231227d 
OP_ENDIF
```

committer server

Create a committer server to inscribe data on block about 10 mins once

parse bitcoin transaction data

Goal

parse bitcoin tx, get from addrerss, to address, amount

Implement

  • Take the output of tx and see if the address of the output is equal to our receiving address
  • If it's equal to the receiving address, go get the value and the sender address
  • sender address is analyzed from input of tx according to txid and n
{
  "txid": "ff234571d6a7711c25ad68ca2eab5e5c8a85626e8dc276b49fcae2892473c5a0",
  "hash": "7ecd5808f3f84ad6b06ff0f19dc7510a6d05c1c4bd3050d091ca75d340df2add",
  "version": 2,
  "size": 253,
  "vsize": 172,
  "weight": 685,
  "locktime": 169611,
  "vin": [
    {
      "txid": "781580fe3ec70c5e1dea51ebb8ea97e42a1f151e4a1b5b0ceea73cbb342a325e",    (Use txid and vout to find from_address)
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "304402202ae6d0b767a36a4d814503d7a6809bb6473c0117827ac6d4b9691faf9cadb6b602207298ed4ab5cd18df71b8ffab447f00c27aa078c3a23a127519fad802321136df01",
        "03b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e177"
      ],
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 0.00100005,  (value)
      "n": 0,
      "scriptPubKey": {
        "asm": "0 e58d88c091846d49d045c19713108e4625b0a962",
        "desc": "addr(tb1qukxc3sy3s3k5n5z9cxt3xyywgcjmp2tzudlz2n)#gfv8e9ks",
        "hex": "0014e58d88c091846d49d045c19713108e4625b0a962",
        "address": "tb1qukxc3sy3s3k5n5z9cxt3xyywgcjmp2tzudlz2n",  (to address)
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.00100005,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 3af616edf94967988eac2eb1c9c43dd5ccbc11f9",
        "desc": "addr(tb1q8tmpdm0ef9ne3r4v96cun3pa6hxtcy0e3f0wdd)#kyzapmdd",
        "hex": "00143af616edf94967988eac2eb1c9c43dd5ccbc11f9",
        "address": "tb1q8tmpdm0ef9ne3r4v96cun3pa6hxtcy0e3f0wdd",
        "type": "witness_v0_keyhash"
      }
    },
    {
      "value": 0.00791291,
      "n": 2,
      "scriptPubKey": {
        "asm": "0 ca6ef3338977842525c3f0e5a584964cf10e2e79",
        "desc": "addr(tb1qefh0xvufw7zz2fwr7rj6tpykfncsutne4p6jv3)#h688732w",
        "hex": "0014ca6ef3338977842525c3f0e5a584964cf10e2e79",
        "address": "tb1qefh0xvufw7zz2fwr7rj6tpykfncsutne4p6jv3",
        "type": "witness_v0_keyhash"
      }
    }
  ],
  "hex": "020000000001015e322a34bb3ca7ee0c5b1b4a1e151f2ae497eab8eb51ea1d5e0cc73efe8015780100000000fdffffff03a586010000000000160014e58d88c091846d49d045c19713108e4625b0a962a5860100000000001600143af616edf94967988eac2eb1c9c43dd5ccbc11f9fb120c0000000000160014ca6ef3338977842525c3f0e5a584964cf10e2e790247304402202ae6d0b767a36a4d814503d7a6809bb6473c0117827ac6d4b9691faf9cadb6b602207298ed4ab5cd18df71b8ffab447f00c27aa078c3a23a127519fad802321136df012103b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e1778b960200"
}




{
  "txid": "781580fe3ec70c5e1dea51ebb8ea97e42a1f151e4a1b5b0ceea73cbb342a325e",
  "hash": "4a277577e89a6cee945af18fc2a3fdc9b7463a72c7515427e23d4998f77aaab7",
  "version": 1,
  "size": 234,
  "vsize": 153,
  "weight": 609,
  "locktime": 0,
  "vin": [
    {
      "txid": "65fc47a4eceb1009066f13fcb0568a19f13c54c997f9e051928ac7420534d932",
      "vout": 1,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "304402203542dcd6e74cb6591b7bb8a0c12a3b5991d16f9126aa7e22207de82782674d780220726866b61579090f1a407168b8447682d304f8cc7f8134cf15840a72fa8ed79f01",
        "03b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e177"
      ],
      "sequence": 4294967285
    }
  ],
  "vout": [
    {
      "value": 0.00003854,
      "n": 0,
      "scriptPubKey": {
        "asm": "1 6a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40c",
        "desc": "rawtr(6a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40c)#msnnw5xu",
        "hex": "51206a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40c",
        "address": "tb1pdgna2q6lsyfgmpfuwexxj3nnuu9knack2ewkpysdc86trz8rcsxqahjz35",
        "type": "witness_v1_taproot"
      }
    },
    {
      "value": 0.00993021,
      "n": 1,
      "scriptPubKey": {
        "asm": "0 99a4deb673f775b750d9a68295dc03b6c02016ac",
        "desc": "addr(tb1qnxjdadnn7a6mw5xe56pfthqrkmqzq94vy5q9s5)#uu0zlr8d",
        "hex": "001499a4deb673f775b750d9a68295dc03b6c02016ac",
        "address": "tb1qnxjdadnn7a6mw5xe56pfthqrkmqzq94vy5q9s5",    (from address)
        "type": "witness_v0_keyhash"
      }
    }
  ],
  "hex": "0100000000010132d9340542c78a9251e0f997c9543cf1198a56b0fc136f060910ebeca447fc650100000000f5ffffff020e0f0000000000002251206a27d5035f81128d853c764c694673e70b69f716565d60920dc1f4b188e3c40cfd260f000000000016001499a4deb673f775b750d9a68295dc03b6c02016ac0247304402203542dcd6e74cb6591b7bb8a0c12a3b5991d16f9126aa7e22207de82782674d780220726866b61579090f1a407168b8447682d304f8cc7f8134cf15840a72fa8ed79f012103b9098132d73034ad2666a5f7449f17428b2075ea5d30bdfb676c82e031e3e17700000000",
  "blockhash": "000000c83c5fd01a26ff50b7338cef38986ec534906eee5c6852fbb06a360800",
  "confirmations": 441,
  "time": 1699857576,
  "blocktime": 1699857576
}

DLC

  1. DLC contract

gen bitcoin config cmd

Goal

Add a bitcoin subcommand,Add a command to create a configuration file under the bitcoin command

There are several points to note:

  1. add cmd after, remove load default config set

b2-node/bitcoin/config.go

Lines 89 to 102 in e9892b1

// if file not exist use default config
// TODO: add gen config command after, The default configuration may not be required
if os.IsNotExist(err) {
config.NetworkName = "signet"
config.RPCHost = "localhost"
config.RPCPort = "8332"
config.RPCUser = "user"
config.RPCPass = "password"
config.WalletName = "walletname"
config.Destination = "tb1qgm39cu009lyvq93afx47pp4h9wxq5x92lxxgnz"
config.IndexerListenAddress = "tb1qsja4hvx66jr9grgmt8452letmz37gmludcrnup"
config.EnableIndexer = false
config.EnableCommitter = false
return &config, nil

  1. b2-node init need execute the command
  2. need write document

pull bitcoin block

Proposal: [pull bitcoin block]

Current behavior: [just initialized bitcoin indexer module]

Desired behavior: [bitcoin indexer module can pull bitcoin block data]

ipfs

  1. run the node
  2. use read and write

Deploy the contract required for Rollup

e5-2690-v3 b2-zkevm-contracts git:(main) ✗ find contracts/*.sol
contracts/PolygonZkEVMBridge.sol
contracts/PolygonZkEVMGlobalExitRootL2.sol
contracts/PolygonZkEVMGlobalExitRoot.sol
contracts/PolygonZkEVM.sol
contracts/PolygonZkEVMTimelock.sol

commit transaction with inspection

docker push 403 Forbidden

https://github.com/b2network/b2-node/actions/runs/6728833059/job/18288753368

Login Succeeded!

Run docker/login-action@v3
  with:
    registry: ghcr.io
    username: b2network
    password: ***
    ecr: auto
    logout: true
  env:
    DOCKER_METADATA_OUTPUT_VERSION: main
    DOCKER_METADATA_OUTPUT_TAGS: ghcr.io/b2network/b2-node:main
  ghcr.io/b2network/b2-node:20231102-055232-408488b
    DOCKER_METADATA_OUTPUT_LABELS: org.opencontainers.image.created=2023-11-02T05:52:32.682Z
  org.opencontainers.image.description=Ethermint is a Cosmos SDK library for running scalable and interoperable EVM chains
  org.opencontainers.image.licenses=LGPL-3.0
  org.opencontainers.image.revision=408488bdecb1027b3fa36e44c3e9751c4639c1e2
  org.opencontainers.image.source=https://github.com/b2network/b2-node
  org.opencontainers.image.title=b2-node
  org.opencontainers.image.url=https://github.com/b2network/b2-node
  org.opencontainers.image.version=main
    DOCKER_METADATA_OUTPUT_JSON: {"tags":["ghcr.io/b2network/b2-node:main","ghcr.io/b2network/b2-node:20231102-055232-408488b"],"labels":{"org.opencontainers.image.created":"2023-11-02T05:52:32.682Z","org.opencontainers.image.description":"Ethermint is a Cosmos SDK library for running scalable and interoperable EVM chains","org.opencontainers.image.licenses":"LGPL-3.0","org.opencontainers.image.revision":"408488bdecb1027b3fa36e44c3e9751c4639c1e2","org.opencontainers.image.source":"https://github.com/b2network/b2-node","org.opencontainers.image.title":"b2-node","org.opencontainers.image.url":"https://github.com/b2network/b2-node","org.opencontainers.image.version":"main"}}
    DOCKER_METADATA_OUTPUT_BAKE_FILE: /tmp/docker-actions-toolkit-XL3koX/docker-metadata-action-bake.json
Logging into ghcr.io...
Login Succeeded!

push failed

#28 exporting to image
#28 exporting attestation manifest sha256:2da383d4cd5bb387b8a207286159b9ed38464669a66e2680aa409cce94c8cf96 done
#28 exporting manifest list sha256:23b2de7f0bb20c74e36683be696eb78b2d34069e2afa1a17c9f2700060c825f2 done
#28 pushing layers
#28 pushing layers 0.2s done
#28 ERROR: failed to push ghcr.io/b2network/b2-node:main: unexpected status from HEAD request to https://ghcr.io/v2/b2network/b2-node/blobs/sha256:f65ae52b1ac32d9682a8165daca91b9253939e8d39bc29e90ca874c652b9f996: 403 Forbidden
------
 > exporting to image:
------
ERROR: failed to solve: failed to push ghcr.io/b2network/b2-node:main: unexpected status from HEAD request to https://ghcr.io/v2/b2network/b2-node/blobs/sha256:f65ae52b1ac32d9682a8165daca91b9253939e8d39bc29e90ca874c652b9f996: 403 Forbidden
Error: buildx failed with: ERROR: failed to solve: failed to push ghcr.io/b2network/b2-node:main: unexpected status from HEAD request to https://ghcr.io/v2/b2network/b2-node/blobs/sha256:f65ae52b1ac32d9682a8165daca91b9253939e8d39bc29e90ca874c652b9f996: 403 Forbidden

@0x677261706562616261

rollup-proof-verifier

Proposal: rollup-proof-verifier will verify rollup state, current we support evm, it actually should fair easy just using verification contract

Current behavior: no verification

Desired behavior: b2 chain verify rollup state

Use case: assume b2 chain instead L1 for rollup, b2 chain is DA and Settlement for rollup

test action nix upload failed

nix upload failed


Run nix-store -r "$(nix-instantiate tests/integration_tests/shell.nix)"
  nix-store -r "$(nix-instantiate tests/integration_tests/shell.nix)"
  shell: /bin/bash -e {0}
  env:
    NIX_SSL_CERT_FILE: /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
    CACHIX_SIGNING_KEY: ***
error:
       … while calling the 'derivationStrict' builtin

         at /derivation-internal.nix:9:12:

            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/54g1wvdwh1g95hkl156wv2sx56iyrfvh-nixpkgs-src/pkgs/stdenv/generic/make-derivation.nix:270:7

       … while evaluating attribute 'shellHook' of derivation 'nix-shell'

         at /nix/store/54g1wvdwh1g95hkl156wv2sx56iyrfvh-nixpkgs-src/pkgs/build-support/mkshell/default.nix:41:3:

           40|
           41|   shellHook = lib.concatStringsSep "\n" (lib.catAttrs "shellHook"
             |   ^
           42|     (lib.reverseList inputsFrom ++ [ attrs ]));

       error: store path 's141mdc5k4j09ls32x3i87pjzimns3vc-.env' starts with illegal character '.'
error: path '/Users/runner/work/b2-node/b2-node' is not in the Nix store
Error: Process completed with exit code 1.

codecov/patch failed

Question Description

set codecov bot , the action will have a codecov/patch error

截屏2023-11-24 16 28 03

Goal

  • Check the patch error cause
  • Look for a reference to control the single test target value

gomod2nix dep

When adding a third party package, you need to address the nix compilation dependency issue

install gomod2nix

https://github.com/nix-community/gomod2nix

Basic usage

After you have entered your development shell you can generate a gomod2nix.toml using:

gomod2nix generate

gomod2nix.toml may be update, after submit this file

We need to document this place in the future

new bitcoin config

new bitcoin network name config

example:

###############################################################################
###                             BITCOIN Configuration                           ###
###############################################################################

[bitcoin]

# Network defines the bitcoin network name to use.
# Names: "mainnet", "testnet", "regtest", "simnet", "testnet3", "signet"
network-name = "mainnet"
```

b2-chain one client network environment

  1. it is currently possible to build and run single-client b2-chain blockchain node. see 1073094
  2. in order to facilitate team dev and testing, all complete data of the chain(not just the conf) can be commit to a git repo.

start network

  1. adjust b2-zkevm-node conf(contract, ip, port, etc.) to adapt to b2-node
  2. adjust b2-zkevm-node genesis(contract, ip, port, etc.) to adapt to b2-node

Some actions need third-party application support

There are several actions env config, whether to set @0x677261706562616261

Send bitcoin tx data to evm

Goal

  • add bitcoin bridge config
  • send bitcoin transfer data to bridge (bridge smart contract deployed to eth)

config

[bridge]
// eth rpc call url
eth-rpc-url = ""
// eth call private key
eth-priv-key = ""
// bridge contract address
contract-address = ""
// brdige contract abi file
abi = ""
// gas limit
gas-limit =

btc node response EOF

testnet
blockHight: 2542794 2542795 2542796 2542797

10:19AM ERR bitcoin indexer parseblock error="error reading json reply: unexpected EOF" currentBlock=2542795 currentTxIndex=0 indexer=bitcoin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.