Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reporter: errors when querying Contains API #36

Open
SebastianElvis opened this issue Sep 13, 2022 · 0 comments · Fixed by #38
Open

Reporter: errors when querying Contains API #36

SebastianElvis opened this issue Sep 13, 2022 · 0 comments · Fixed by #38
Labels
bug Something isn't working

Comments

@SebastianElvis
Copy link
Member

Description

When the vigilant reporter queries Contains API of BBN's BTCLightclient module, the program panics due to the error panic: invalid Go type *types.BTCHeaderHashBytes for field babylon.btclightclient.v1.QueryContainsRequest.hash.

➜  vigilante git:(fix-invalid-stop-height) ✗ go run $VIGILANTE_PATH/cmd/main.go reporter \
         --config $TESTNET_PATH/vigilante/vigilante.yml \
         --babylon-key $BABYLON_PATH/.testnet/node0/babylond
# github.com/keybase/go-keychain
cgo-gcc-prolog:81:11: warning: 'SecKeychainCreate' is deprecated: first deprecated in macOS 12.0 - Custom keychain management is no longer supported [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecKeychain.h:301:10: note: 'SecKeychainCreate' has been explicitly marked deprecated here
cgo-gcc-prolog:139:11: warning: 'SecKeychainLock' is deprecated: first deprecated in macOS 12.0 - Custom keychain management is no longer supported [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecKeychain.h:357:10: note: 'SecKeychainLock' has been explicitly marked deprecated here
cgo-gcc-prolog:159:11: warning: 'SecKeychainOpen' is deprecated: first deprecated in macOS 12.0 - Custom keychain management is no longer supported [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecKeychain.h:287:10: note: 'SecKeychainOpen' has been explicitly marked deprecated here
cgo-gcc-prolog:183:11: warning: 'SecKeychainUnlock' is deprecated: first deprecated in macOS 12.0 - Custom keychain management is no longer supported [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecKeychain.h:347:10: note: 'SecKeychainUnlock' has been explicitly marked deprecated here
cgo-gcc-prolog:203:11: warning: 'SecTrustedApplicationCreateFromPath' is deprecated: first deprecated in macOS 10.15 - No longer supported [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Security.framework/Headers/SecTrustedApplication.h:59:10: note: 'SecTrustedApplicationCreateFromPath' has been explicitly marked deprecated here
# command-line-arguments
ld: warning: could not create compact unwind for _blst_sha256_block_data_order: does not use RBP or RSP based frame
INFO[2022-09-13T15:27:14+10:00] Successfully loaded config file at /Users/runchao/Projects/Babylon/babylon/.testnet/vigilante/vigilante.yml  module=config
INFO[2022-09-13T15:27:14+10:00] Successfully created the BTC client and connected to the BTC server  module=btcclient
INFO[2022-09-13T15:27:14+10:00] Successfully subscribed to newly connected/disconnected blocks from BTC  module=btcclient
DEBU[2022-09-13T15:27:14+10:00] Babylon key directory: /Users/runchao/Projects/Babylon/babylon/.testnet/node0/babylond  module=babylonclient
DEBU[2022-09-13T15:27:14+10:00] All Babylon addresses: map[node0:bbn1frqvgku0y0vcd7eukt8l5mll0ku324jnhdx2lk]  module=babylonclient
INFO[2022-09-13T15:27:14+10:00] Successfully created the Babylon client       module=babylonclient
INFO[2022-09-13T15:27:14+10:00] BTCCheckpoint parameters: (k, w) = (6, 20)    module=reporter
INFO[2022-09-13T15:27:14+10:00] Successfully generated TLS certificates for the RPC server  module=rpcserver
INFO[2022-09-13T15:27:14+10:00] BTC latest block hash and height: (3654ae02750265fa75802d752f75416d5105e604c270f5d3be72933fdfe923bf, 14)  module=reporter
INFO[2022-09-13T15:27:14+10:00] BBN header chain latest block hash and height: (683e86bd5c6d110d91b94b97137ba6bfe02dbbdb8e3dff722a669b5d69d77af6, 0)  module=reporter
DEBU[2022-09-13T15:27:15+10:00] BTC cache size: 15                            module=reporter
DEBU[2022-09-13T15:27:15+10:00] block for consistency check: height 0, hash 683e86bd5c6d110d91b94b97137ba6bfe02dbbdb8e3dff722a669b5d69d77af6  module=reporter
panic: invalid Go type *types.BTCHeaderHashBytes for field babylon.btclightclient.v1.QueryContainsRequest.hash

goroutine 1 [running]:
google.golang.org/protobuf/internal/impl.newSingularConverter({0x59eb680?, 0x50e7280}, {0x59ec788, 0xc000d39590})
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/convert.go:143 +0xb99
google.golang.org/protobuf/internal/impl.NewConverter({0x59eb680, 0x50e7280}, {0x59ec788?, 0xc000d39590?})
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/convert.go:60 +0xa5
google.golang.org/protobuf/internal/impl.fieldInfoForScalar({0x59ec788, 0xc000d39590}, {{0x5036ee5, 0x4}, {0x0, 0x0}, {0x59eb680, 0x50e7280}, {0x5036eeb, 0x81}, ...}, ...)
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/message_reflect_field.go:270 +0x18a
google.golang.org/protobuf/internal/impl.(*MessageInfo).makeKnownFieldsFunc(0xc000fe02c0, {0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, {0x0, 0x0}, ...})
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/message_reflect.go:80 +0x7c8
google.golang.org/protobuf/internal/impl.(*MessageInfo).makeReflectFuncs(0xc000fe02c0?, {0x59eb680, 0x5004140}, {0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, {0x0, 0x0}, 0xffffffffffffffff, ...})
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/message_reflect.go:42 +0x65
google.golang.org/protobuf/internal/impl.(*MessageInfo).initOnce(0xc000fe02c0)
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/message.go:90 +0x1d0
google.golang.org/protobuf/internal/impl.(*MessageInfo).init(...)
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/message.go:72
google.golang.org/protobuf/internal/impl.(*messageReflectWrapper).ProtoMethods(0xc000fcac60?)
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/internal/impl/message_reflect_gen.go:150 +0x31
google.golang.org/protobuf/proto.protoMethods(...)
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/proto/proto_methods.go:19
google.golang.org/protobuf/proto.MarshalOptions.marshal({{}, 0x48?, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x59e8d20, 0xc000fcac60})
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/proto/encode.go:143 +0x69
google.golang.org/protobuf/proto.MarshalOptions.MarshalAppend({{}, 0xa0?, 0xf4?, 0xe?}, {0x0, 0x0, 0x0}, {0x59cc700?, 0xc000fcac60?})
        /Users/runchao/go/pkg/mod/google.golang.org/protobuf@v1.28.1/proto/encode.go:125 +0x79
github.com/golang/protobuf/proto.marshalAppend({0x0, 0x0, 0x0}, {0x59d1d60?, 0xc000010708?}, 0x5?)
        /Users/runchao/go/pkg/mod/github.com/golang/protobuf@v1.5.2/proto/wire.go:40 +0xa5
github.com/golang/protobuf/proto.Marshal(...)
        /Users/runchao/go/pkg/mod/github.com/golang/protobuf@v1.5.2/proto/wire.go:23
google.golang.org/grpc/encoding/proto.codec.Marshal({}, {0x50ef4a0, 0xc000010708})
        /Users/runchao/go/pkg/mod/google.golang.org/grpc@v1.48.0/encoding/proto/proto.go:45 +0x4e
github.com/strangelove-ventures/lens/client.(*ChainClient).RunGRPCQuery(0x203000?, {0x59e0ca0, 0xc000fd8d80}, {0x51caffe, 0x29}, {0x50ef4a0?, 0xc000010708?}, 0xc000fcc7e0?)
        /Users/runchao/go/pkg/mod/github.com/strangelove-ventures/lens@v0.5.1/client/grpc_query.go:94 +0xb1
github.com/strangelove-ventures/lens/client.(*ChainClient).Invoke(0xc000eea000, {0x59e0ca0, 0xc000fd8d80}, {0x51caffe, 0x29}, {0x50ef4a0, 0xc000010708?}, {0x50fd6e0?, 0xc000fce60f}, {0x0, ...})
        /Users/runchao/go/pkg/mod/github.com/strangelove-ventures/lens@v0.5.1/client/grpc_query.go:59 +0x317
github.com/babylonchain/babylon/x/btclightclient/types.(*queryClient).Contains(0xc000ddf608, {0x59e0ca0, 0xc000fd8d80}, 0xc001171320?, {0x0, 0x0, 0x0})
        /Users/runchao/go/pkg/mod/github.com/babylonchain/babylon@v0.0.0-20220913005840-2b85f0b64e9b/x/btclightclient/types/query.pb.go:673 +0xce
github.com/babylonchain/vigilante/babylonclient.(*Client).QueryContainsBlock(0xc000ee6bc0, 0xe02dbbdb00000005?)
        /Users/runchao/Projects/Babylon/vigilante/babylonclient/query.go:149 +0x1a7
github.com/babylonchain/vigilante/reporter.(*Reporter).Init(0xc001173a70)
        /Users/runchao/Projects/Babylon/vigilante/reporter/bootstrapping.go:101 +0x6a9
github.com/babylonchain/vigilante/cmd/reporter.cmdFunc(0xc000215400?, {0x5192f91?, 0x4?, 0x4?})
        /Users/runchao/Projects/Babylon/vigilante/cmd/reporter/reporter.go:74 +0x24d
github.com/spf13/cobra.(*Command).execute(0xc000215400, {0xc0000f55c0, 0x4, 0x4})
        /Users/runchao/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:876 +0x67b
github.com/spf13/cobra.(*Command).ExecuteC(0xc000215180)
        /Users/runchao/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/runchao/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
main.main()
        /Users/runchao/Projects/Babylon/vigilante/cmd/main.go:22 +0x125
exit status 2

Steps to reproduce

Follow README to launch the vigilant reporter.

@SebastianElvis SebastianElvis added the bug Something isn't working label Sep 13, 2022
@vitsalis vitsalis reopened this Sep 14, 2022
gitferry pushed a commit that referenced this issue Jan 25, 2024
NOTE: babylonchain/vigilante-private#36
mistakenly points to
[fix-slashing-enforcer](https://github.com/babylonchain/vigilante-private/tree/fix-slashing-enforcer)
rather than `dev`. Created this PR to `dev` again. Everything is same as
#36

---

Fixes [BM-940](https://babylon-chain.atlassian.net/browse/BM-940)

This PR implements atomic slasher routine. It is responsible for probing
Bitcoin on any selective slashing attack launched by the finality
provider, and slashing all BTC delegations under the finality provider
who does selective slashing. It contains 3 subroutines
`btcDelegationTracker`, `slashingTxTracker`, and
`selectiveSlashingReporter` and works as follows:

- `btcDelegationTracker`: periodically poll BTC delegations from
babylon, and builds index of staking/slashing/unbondingslashing txs.
- `slashingTxTracker`: upon each BTC block, find whether there is
staking/slashing/unbondingslashing tx. If yes, forward slashing tx
information to `selectiveSlashingReporter`.
- `selectiveSlashingReporter`: upon each slashing tx, extract the
finality provider's SK and send to BTC slasher's slashing enforcer
routine, which will slash this finality provider.

This PR also includes e2e tests on the atomic slasher.

TODOs that will be done in future PRs:
- [ ] fine-grained fuzz tests
- [ ] trimming expired/slashed BTC delegations from the index, for
saving memory usage
- [ ] bootstrapping process for starting from a certain BTC height, for
crash recovery

NOTE:
- [x] wait until
babylonchain/vigilante-private#44 is merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants