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

feat!: version the application constants #1768

Merged
merged 30 commits into from
May 25, 2023
Merged

feat!: version the application constants #1768

merged 30 commits into from
May 25, 2023

Conversation

cmwaters
Copy link
Contributor

Closes: #1625

@MSevey MSevey requested a review from a team May 15, 2023 12:45
Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would defer to other reviewers for final approvals.

Left some comments to understand more

pkg/appconsts/global_consts.go Show resolved Hide resolved
pkg/appconsts/versioned_consts.go Outdated Show resolved Hide resolved
pkg/appconsts/versioned_consts.go Outdated Show resolved Hide resolved
pkg/inclusion/paths_test.go Show resolved Hide resolved
pkg/square/builder.go Outdated Show resolved Hide resolved
pkg/square/builder.go Outdated Show resolved Hide resolved
pkg/square/builder.go Show resolved Hide resolved
test/util/network/network.go Show resolved Hide resolved
@MSevey MSevey requested a review from a team May 15, 2023 15:47
rootulp
rootulp previously approved these changes May 15, 2023
pkg/appconsts/v1/app_consts.go Outdated Show resolved Hide resolved
pkg/appconsts/versioned_consts.go Outdated Show resolved Hide resolved
pkg/appconsts/versioned_consts.go Outdated Show resolved Hide resolved
staheri14
staheri14 previously approved these changes May 15, 2023
Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -49,7 +49,7 @@ func TestNewDataAvailabilityHeader(t *testing.T) {
{
name: "max square size",
expectedHash: []byte{0xce, 0x5c, 0xf3, 0xc9, 0x15, 0xeb, 0xbf, 0xb0, 0x67, 0xe1, 0xa5, 0x97, 0x35, 0xf3, 0x25, 0x7b, 0x1c, 0x47, 0x74, 0x1f, 0xec, 0x6a, 0x33, 0x19, 0x7f, 0x8f, 0xc2, 0x4a, 0xe, 0xe2, 0xbe, 0x73},
squareSize: appconsts.DefaultMaxSquareSize,
squareSize: uint64(appconsts.DefaultMaxSquareSize),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about defaulting to unit64 as the type for any square size type/variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol I went back and forth a few times between uint64 and int. On one hand uint64 is the type that protobuf encodes this variable; on the other hand this is used a lot with len(...) i.e. len(shares) == squareSize * squareSize so it has value as an int. I'm fine with either. In either case there will be conversion and there would have to be some other bug for it to overflow in conversion

Copy link
Contributor

@staheri14 staheri14 May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with either. In either case there will be conversion and there would have to be some other bug for it to overflow in conversion

I see. The point is to make sure that the data type remains consistent throughout the code (but when sending the data on the wire, as you said, the conversion would be inevitable), I have no strong preference for int or uint64 as well, totally up to you.

pkg/inclusion/get_commit.go Show resolved Hide resolved
pkg/inclusion/paths_test.go Show resolved Hide resolved
Co-authored-by: CHAMI Rachid <chamirachid1@gmail.com>
Co-authored-by: Rootul P <rootulp@gmail.com>
@cmwaters cmwaters dismissed stale reviews from staheri14 and rootulp via 3e83719 May 15, 2023 19:37
@MSevey MSevey requested a review from a team May 15, 2023 19:38
staheri14
staheri14 previously approved these changes May 15, 2023
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! left one non blocking naming comment

pkg/appconsts/versioned_consts.go Show resolved Hide resolved
evan-forbes

This comment was marked as duplicate.

evan-forbes

This comment was marked as duplicate.

@cmwaters cmwaters dismissed stale reviews from evan-forbes and staheri14 via de5cc51 May 16, 2023 07:58
@MSevey MSevey requested a review from a team May 16, 2023 07:58
rootulp
rootulp previously approved these changes May 16, 2023
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2023

Codecov Report

Merging #1768 (27be053) into main (456e6fd) will decrease coverage by 0.14%.
The diff coverage is 41.83%.

@@            Coverage Diff             @@
##             main    #1768      +/-   ##
==========================================
- Coverage   21.90%   21.76%   -0.14%     
==========================================
  Files         116      116              
  Lines       13208    13236      +28     
==========================================
- Hits         2893     2881      -12     
- Misses      10024    10063      +39     
- Partials      291      292       +1     
Impacted Files Coverage Δ
app/default_overrides.go 23.37% <0.00%> (-0.95%) ⬇️
app/prepare_proposal.go 0.00% <0.00%> (ø)
app/process_proposal.go 0.00% <0.00%> (ø)
app/square_size.go 0.00% <0.00%> (ø)
pkg/da/data_availability_header.go 77.22% <ø> (+6.19%) ⬆️
pkg/inclusion/get_commit.go 0.00% <0.00%> (ø)
pkg/proof/querier.go 21.50% <0.00%> (ø)
test/util/testnode/full_node.go 0.00% <0.00%> (ø)
test/util/testnode/genesis_options.go 0.00% <0.00%> (ø)
test/util/testnode/node_interaction_api.go 0.00% <0.00%> (ø)
... and 11 more

... and 1 file with indirect coverage changes

rootulp
rootulp previously approved these changes May 24, 2023
app/square_size.go Outdated Show resolved Hide resolved
app/test/integration_test.go Outdated Show resolved Hide resolved
app/test/integration_test.go Outdated Show resolved Hide resolved
app/test/square_size_test.go Outdated Show resolved Hide resolved
app/test/square_size_test.go Outdated Show resolved Hide resolved
x/blob/keeper/params.go Outdated Show resolved Hide resolved
x/blob/types/params_test.go Outdated Show resolved Hide resolved
Comment on lines -87 to -93
if govMaxSquareSize > appconsts.MaxSquareSize {
return fmt.Errorf(
"gov max square size cannot exceed the max square size: max %d",
appconsts.MaxSquareSize,
)
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[question] out of curiosity why is this part of validation no longer necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was discussed out of band. The crux is that validation of params does not accept any arguments yet this capped value depends on the version of the network, thus we can no longer correctly validate it here and need to do so elsewhere

Co-authored-by: Rootul P <rootulp@gmail.com>
@MSevey MSevey requested a review from a team May 25, 2023 09:48
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last question, and then I think this is ready to go!

@@ -282,6 +282,9 @@ func NewAppServer(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts se
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
baseapp.SetSnapshot(snapshotStore, snapshottypes.NewSnapshotOptions(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)))),
func(b *baseapp.BaseApp) {
b.SetProtocolVersion(appconsts.LatestVersion)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocking question]
what happens if we're syncing from a previous block that is not at the latest version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's okay. The ProtocolVersion that gets set can be interpreted as the highest version the binary can execute on. All prior versions should be handled

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmwaters answered my question during a sync, updating the version here doesn't have an effect on past headers, so syncing from a past block will work as expected.

one additional [non blocking] question, will this have an effect for single binary upgrades? like, if a validator upgrades early, sets the protocol version to the latest here when does that value get conveyed back to tendermint and included in the consensus logic?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I need hit refresh more often, wrote my comment w/o the context of the second one.

I'll look into the exact mechanism more

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I need to look into this more. There's definitely an incongruence in the way we want to do things and the way that the SDK is set up to do things. I definitely think there needs to be more thinking in how we bridge the gap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The app version is used in the Info handshake to ensure that the app has the same version as the last block processed by Comet. To ensure we always give the correct version to Comet, the app needs to know the last version it saw in a block. In the case this is the first height, it should actually be the first version i.e. 1. We should even have it hardcoded such that users can't start with a non 1 version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this PR for now as upgrades is more of a different issue that we need to address

@MSevey MSevey requested a review from a team May 25, 2023 13:52
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also it looks like we are using the initialization logic from the cmd pkg in the testnode, which is what I missed before with #1768 (review)

app := cmd.NewAppServer(logger, db, nil, appOpts)

LGTM! 👍 👍

@cmwaters cmwaters merged commit 5b35a01 into main May 25, 2023
18 checks passed
@cmwaters cmwaters deleted the cal/const-versions branch May 25, 2023 15:01
evan-forbes pushed a commit that referenced this pull request May 26, 2023
Closes: #1625

---------

Co-authored-by: CHAMI Rachid <chamirachid1@gmail.com>
Co-authored-by: Rootul P <rootulp@gmail.com>
evan-forbes pushed a commit that referenced this pull request May 26, 2023
Closes: #1625

---------

Co-authored-by: CHAMI Rachid <chamirachid1@gmail.com>
Co-authored-by: Rootul P <rootulp@gmail.com>
@rootulp rootulp mentioned this pull request Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version the constants
6 participants