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

x/gravity: refactor state #319

Closed
wants to merge 81 commits into from
Closed
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
c468002
define api
tac0turtle Mar 15, 2021
8e9fade
define claims and confirms
tac0turtle Mar 15, 2021
d307e6b
interfaces
tac0turtle Mar 15, 2021
9d56880
regenerate proto stubs
tac0turtle Mar 22, 2021
ea62a84
define claim handler, fix cli/tx.go
tac0turtle Mar 23, 2021
ec02649
claims
tac0turtle Mar 24, 2021
d1fe57c
Merge branch 'refactor' into marko/api_any
tac0turtle Mar 24, 2021
7fac6ff
debug tests
tac0turtle Mar 24, 2021
35b2be5
fix error and confirm submisison
tac0turtle Mar 25, 2021
da9da06
fix naming
tac0turtle Mar 25, 2021
b6b72f1
x/gravity: state refactor
fedekunze Apr 4, 2021
380409d
new state (wip)
fedekunze Apr 7, 2021
992a758
pool and batch (wip)
fedekunze Apr 8, 2021
06cad68
refactor batch
fedekunze Apr 8, 2021
df951d0
abci and slash refactor (wip)
fedekunze Apr 8, 2021
fd60831
Merge branch 'refactor' into marko/api_any
tac0turtle Apr 10, 2021
3c3ed6f
regen proto
Apr 10, 2021
008ba10
logic call, eth signer set and attestation handler (wip)
fedekunze Apr 12, 2021
d72b636
update proto and attestations
fedekunze Apr 12, 2021
7fc0bfb
proto docs (wip)
fedekunze Apr 12, 2021
a5509a6
wip
fedekunze Apr 12, 2021
31c3660
bump sdk and tendermint versions
fedekunze Apr 13, 2021
14bb3d3
additional keeper cleanup
fedekunze Apr 14, 2021
522f810
fix conflicts
fedekunze Apr 15, 2021
83980a7
types changes
fedekunze Apr 15, 2021
fb60d4e
update types
fedekunze Apr 15, 2021
e496224
wip types
fedekunze Apr 16, 2021
3101404
proto changes
fedekunze Apr 16, 2021
bdd9f6b
type refactor (wip)
fedekunze Apr 16, 2021
5b9533e
conflicts
fedekunze Apr 19, 2021
f621018
update batches
fedekunze Apr 19, 2021
4165751
tx id as HexBytes
fedekunze Apr 19, 2021
a2a2f6c
keeper: prefix and hashes
fedekunze Apr 19, 2021
38115e9
rm old keeper
fedekunze Apr 19, 2021
b960c90
batch cleanup
fedekunze Apr 20, 2021
5135c88
cleanup Endblock and slashing
fedekunze Apr 21, 2021
3d9c425
rm CLI and fix RegisterERC20
fedekunze Apr 21, 2021
3f4586f
proto fixes
fedekunze Apr 22, 2021
a208908
update attestation callbacks
fedekunze Apr 26, 2021
175ded2
fix proto
fedekunze Apr 26, 2021
9f2f736
initial tests
mvid Apr 26, 2021
460b37e
Merge branch 'fedekunze/state' of github.com:cosmos/gravity-bridge in…
mvid Apr 26, 2021
bfd46c6
initial denom validation tests
mvid Apr 26, 2021
664c3d0
update error messages
fedekunze Apr 27, 2021
a8d804b
minor proto and checkpoint changes
fedekunze Apr 27, 2021
bb70046
fix signer set
fedekunze Apr 27, 2021
e6715be
types validation
fedekunze Apr 28, 2021
eec507f
update confirm
fedekunze Apr 28, 2021
914119b
signer set confirm
fedekunze Apr 28, 2021
695f51e
raw init and export genesis
fedekunze Apr 28, 2021
0cd1801
Merge branch 'fedekunze/state' of github.com:cosmos/gravity-bridge in…
mvid Apr 28, 2021
3d425fd
params and denom tests
mvid Apr 28, 2021
cfcd842
initial msgs tests
mvid Apr 28, 2021
adb59f7
failing confirm tests
mvid Apr 28, 2021
b59134f
packing for any
mvid Apr 28, 2021
1b8e3cd
test example
fedekunze Apr 29, 2021
38e2997
set confirm
fedekunze Apr 29, 2021
7b0f2a0
fixed 'any' tests
mvid Apr 29, 2021
2f1bf44
merge
mvid Apr 29, 2021
9567721
test update
mvid Apr 29, 2021
0b30bbf
event tests
mvid Apr 29, 2021
2f3147e
basic genesis state test
mvid Apr 29, 2021
a51b4ec
Add docs for Relaying ETH to Cosmos
jkilpatr Apr 12, 2021
3cb9a21
Add relayer semantics doc
jkilpatr Apr 13, 2021
ad1fe6d
Override localhost in the test runner with environment variable to en…
zmanian Apr 28, 2021
93931d2
initial keeper tests
mvid Apr 29, 2021
3af376e
Merge branch 'fedekunze/state' of github.com:cosmos/gravity-bridge in…
mvid Apr 29, 2021
a774e9b
remove unused arg
mvid Apr 29, 2021
550cfa4
short circuit if gravity node is down
mvid Apr 29, 2021
41a004a
keeper setup
fedekunze Apr 30, 2021
51022bc
fix events
fedekunze Apr 30, 2021
e75c1db
slashing
fedekunze Apr 30, 2021
7cc848e
minor cleanup
fedekunze Apr 30, 2021
8aef3ba
rm transfer tx from batch (wip)
fedekunze Apr 30, 2021
d06441a
keeper tests
mvid Apr 30, 2021
15cf910
Merge branch 'fedekunze/state' of github.com:cosmos/gravity-bridge in…
mvid Apr 30, 2021
0fd4806
attestation and genesis fixes
fedekunze May 3, 2021
cd48f45
Merge branch 'fedekunze/state' of github.com:cosmos/gravity-bridge in…
fedekunze May 3, 2021
74a14d4
genesis wip
fedekunze May 3, 2021
ed24035
Push wip work from pairing
jackzampolin May 3, 2021
3c37256
WIP pairing
jackzampolin May 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions module/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
Language: Proto
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
RawStringFormats:
- Delimiters:
- pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

23 changes: 21 additions & 2 deletions module/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,31 @@ lint:
### Protobuf ###
###############################################################################

containerProtoVer=v0.2
containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer)

proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.1 sh ./contrib/local/protocgen.sh
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./contrib/local/protocgen.sh; fi

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protoc-swagger-gen.sh; fi

proto-format:
@echo "Formatting Protobuf files"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then docker start -a $(containerProtoFmt); else docker run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {}; fi

proto-lint:
@$(DOCKER_BUF) check lint --error-format=json
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
Expand Down
7 changes: 6 additions & 1 deletion module/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,16 @@ func NewGravityApp(
appCodec,
keys[gravitytypes.StoreKey],
app.GetSubspace(gravitytypes.ModuleName),
stakingKeeper,
app.stakingKeeper,
app.bankKeeper,
app.slashingKeeper,
)

// set the handler for ethereum events attestations
app.gravityKeeper.SetAttestationHandler(
keeper.NewAttestationHandler(app.gravityKeeper),
)

var skipGenesisInvariants = cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants))

app.mm = module.NewManager(
Expand Down
6 changes: 3 additions & 3 deletions module/cmd/gravity/cmd/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ $ %s gentx my-key-name 1000000stake 0x033030FEeBd93E3178487c35A9c8cA80874353C9 c
}

delegateGravityMsg := &gravitytypes.MsgDelegateKey{
Validator: sdk.ValAddress(key.GetAddress()).String(),
Orchestrator: orchAddress.String(),
EthAddress: ethAddress,
ValidatorAddress: sdk.ValAddress(key.GetAddress()).String(),
OrchestratorAddress: orchAddress.String(),
EthAddress: ethAddress,
}

msgs := []sdk.Msg{msg, delegateGravityMsg}
Expand Down
19 changes: 0 additions & 19 deletions module/contrib/local/protocgen.sh

This file was deleted.

5 changes: 3 additions & 2 deletions module/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/cosmos/gravity-bridge/module
go 1.15

require (
github.com/cosmos/cosmos-sdk v0.42.1
github.com/cosmos/cosmos-sdk v0.42.4
github.com/ethereum/go-ethereum v1.9.21
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.4.3
Expand All @@ -16,10 +16,11 @@ require (
github.com/spf13/cobra v1.1.1
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.8
github.com/tendermint/tendermint v0.34.9
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f
google.golang.org/grpc v1.35.0
google.golang.org/protobuf v1.25.0
)

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4
Expand Down
13 changes: 6 additions & 7 deletions module/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/bufbuild/buf v0.40.0 h1:Cyg0Ag83mC5xaepo3b+7vmhh3J7R+5KesM/kjZcsr0A=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down Expand Up @@ -126,13 +125,11 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/cosmos-sdk v0.42.1 h1:/0SqvXdxbHBRUFRTLdiL4VYE18DMNXd2ONhC5d90EBQ=
github.com/cosmos/cosmos-sdk v0.42.1/go.mod h1:xiLp1G8mumj82S5KLJGCAyeAlD+7VNomg/aRSJV12yk=
github.com/cosmos/cosmos-sdk v0.42.4 h1:yaD4PyOx0LnyfiWasC5egg1U76lT83GRxjJjupPo7Gk=
github.com/cosmos/cosmos-sdk v0.42.4/go.mod h1:I1Zw1zmU4rA/NITaakTb71pXQnQrWyFBhqo3WSeg0vA=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gravity-bridge/module v0.0.0-20210322173118-25d77b5f9b46 h1:XXCzKCfiWWnn6sjNISC/pv+GbfEd03bCpu0IXCnS9TA=
github.com/cosmos/gravity-bridge/module v0.0.0-20210322173118-25d77b5f9b46/go.mod h1:jEI1pLV70xW9prKdBnKroKWIpYXjcVyn4BQQcwXHs40=
github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE=
github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I=
github.com/cosmos/iavl v0.15.3 h1:xE9r6HW8GeKeoYJN4zefpljZ1oukVScP/7M8oj6SUts=
Expand Down Expand Up @@ -270,6 +267,8 @@ github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSN
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us=
github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
Expand Down Expand Up @@ -639,8 +638,8 @@ github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoM
github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4=
github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg=
github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ=
github.com/tendermint/tendermint v0.34.8 h1:PMWgUx47FrNTsfhxCWzoiIlVAC1SE9+WBlnsF9oQW0I=
github.com/tendermint/tendermint v0.34.8/go.mod h1:JVuu3V1ZexOaZG8VJMRl8lnfrGw6hEB2TVnoUwKRbss=
github.com/tendermint/tendermint v0.34.9 h1:9P2MXDEPOcPW0NBcHQ/HDSfvczZm+q5nUUw7AZ6f1Vc=
github.com/tendermint/tendermint v0.34.9/go.mod h1:kl4Z1JwGx1I+u1SXIzMDy7Z3T8LiMeCAOnzNn6AIMT4=
github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI=
github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8=
github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ=
Expand Down
48 changes: 0 additions & 48 deletions module/proto/gravity/v1/attestation.proto

This file was deleted.

36 changes: 0 additions & 36 deletions module/proto/gravity/v1/batch.proto

This file was deleted.

Loading