Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

new chain_config param: action return value limit - #9451

Merged
dimas1185 merged 2 commits into
developfrom
ret-val-limit-rc2
Aug 28, 2020
Merged

dimas1185 merged 2 commits into
developfrom
ret-val-limit-rc2

Conversation

@dimas1185

@dimas1185 dimas1185 commented Aug 26, 2020 •

Copy link
Copy Markdown
Contributor

Change Description

Consensus change.

Currently action return values are limited only by CPU and max wasm memory which is 20MB.
We need to provide node operators a way to prevent users from filling their SHiP logs with noise.

This change includes following changes:

  1. adding max_action_return_value_size to chain_config. default value is 256 bytes.
    this config value is used in set_action_return_value host function:
  2. adding wql-max-action-return-value command line option to rodeos with default value of 20MB.
    it is used in set_action_return_value from rodeos/callbacks/action.hpp

Change Type

Select ONE

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

* - forwards compatible with versions 2 and 3
* - kv database
* - Configurable wasm limits
* 5: Updated for v4.0.0 protocol features:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these are supposed to reference the eosio release number, so this (and the comment above it) is not accurate. These would be v2.1.0 features.

Comment thread libraries/fc/include/fc/utility.hpp Outdated
#define MAX_NUM_ARRAY_ELEMENTS (1024*1024)
#define MAX_SIZE_OF_BYTE_ARRAYS (20*1024*1024)

static_assert(MAX_SIZE_OF_BYTE_ARRAYS == 20*1024*1024, "Changing MAX_SIZE_OF_BYTE_ARRAYS breaks consensus. Make sure this is expected");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will need to be ported to the fc repo as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this belongs in fc when fc is a separate repo. Someone might be using fc for something completely different. I think we should move this static_assert into libraries/chain/include/eosio/chain/config.hpp

Comment on lines +277 to +278
//initial requirements were to skip packing field if it is not activated.
//this approach allows to spam this function with big buffer so changing this behavior

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, skipping entries was wrong

  • The contract has no way to know that the value was skipped and is likely to behave incorrectly.
  • When the protocol feature is not activated, the old version of nodeos that doesn't know about the entry MUST behave the same as the new version of nodeos that does. Skipping known but unactivated entries violates this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@swatanabe-b1 do you propose to remove the requirement for skipping/throwing exception in get_parameters_packed ? so inactive config should be presented regardless activation status

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not suggesting any functional changes. The comment indicates that this change is an optimization. I'm saying that it's also necessary for correctness. I think throwing an exception is the correct behavior for inactive config entries.

Comment thread libraries/chain/chain_config.cpp Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this used anywhere? If it's defined here it won't be instantiated if it's used in another translation unit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add an additional comment: do not add more to this list; doing so will break chain_config_v1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Never mind. It's already implied by the v0/v1 inheritance.

@tbfleming

Copy link
Copy Markdown
Contributor

ship changes and rodeos changes look correct

@dimas1185
dimas1185 merged commit 2011a24 into develop Aug 28, 2020
@dimas1185
dimas1185 deleted the ret-val-limit-rc2 branch August 31, 2020 23:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants