abci++: add proto fields for enabling vote extensions (#8587)

This pull requests adds the protocol buffer field for the `ABCI.VoteExtensionsEnableHeight` parameter. This proto field is threaded throughout all of the relevant places where consensus params are used and referenced.

This PR also adds validation of the consensus param updates. Previous consensus param changes didn't depend on _previous_ versions of the params, so this change adds a method for validating against the old params as well.

closes: #8453
This commit is contained in:
William Banfield
2022-05-23 18:23:23 +00:00
committed by GitHub
parent 6ff77eece3
commit 43313e9b85
14 changed files with 553 additions and 129 deletions
+13 -3
View File
@@ -3,6 +3,7 @@ package e2e_test
import (
"bytes"
"context"
"errors"
"fmt"
"math/rand"
"strconv"
@@ -190,16 +191,25 @@ func TestApp_Tx(t *testing.T) {
func TestApp_VoteExtensions(t *testing.T) {
testNode(t, func(ctx context.Context, t *testing.T, node e2e.Node) {
t.Skip()
client, err := node.Client()
require.NoError(t, err)
info, err := client.ABCIInfo(ctx)
require.NoError(t, err)
// This special value should have been created by way of vote extensions
resp, err := client.ABCIQuery(ctx, "", []byte("extensionSum"))
require.NoError(t, err)
extSum, err := strconv.Atoi(string(resp.Response.Value))
require.NoError(t, err)
require.GreaterOrEqual(t, extSum, 0)
// if extensions are not enabled on the network, we should not expect
// the app to have any extension value set.
if node.Testnet.VoteExtensionsEnableHeight == 0 ||
info.Response.LastBlockHeight < node.Testnet.VoteExtensionsEnableHeight+1 {
target := &strconv.NumError{}
require.True(t, errors.As(err, &target))
} else {
require.NoError(t, err)
require.GreaterOrEqual(t, extSum, 0)
}
})
}