Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

method signature lookups, parameter decoding & management #2313

Merged
merged 55 commits into from
Sep 27, 2016

Conversation

jacogr
Copy link
Contributor

@jacogr jacogr commented Sep 25, 2016

There are 2 parts to this -

  • dapp for on-chain signature management. (PR open for that under contracts as well)
  • initial lookup, decoding and display of transaction methods against the signature registry (only shows up on transactions view currently)

Future work -

  • make methods display & parameters look nice, not “techy”
  • shared component for this to be added to Signer (consistent view, all transactions in the app show the decoded details)

Demos -

Linked issues -

Dependencies -

# Conflicts:
#	js/src/abi/spec/function.js
* jg-abi-method-input-decode:
  decodeInputDat to deocdeCallData
  functions to allow the decoding of method inputs
* jg-abi-method-input-decode:
  updated invalid & failing tests
  don't fail on contract creation encoding
  return empty when null supplied

# Conflicts:
#	js/src/abi/decoder/decoder.spec.js
#	js/src/api/util/decode.js
@parity-cla-bot
Copy link

It looks like this contributor signed our Contributor License Agreement. 👍

Many thanks,

Ethcore CLA Bot

@jacogr jacogr added the A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. label Sep 25, 2016

import * as abis from '../json';

export default class Registry {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why a class here? A simple function returning an object with getContractInstance and lookupAddress would have done the job and is conceptually a lot simpler than a class.

Copy link
Contributor

Choose a reason for hiding this comment

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

(same thing for src/contracts/signaturereg.js, src/contracts/tokenreg.js and src/contracts/tokenreg.js)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On purpose, to lessen congnitive overload. Use classes everywhere, so didn't deviate. I actually realised that with the 3rdparty stuff where we don't, it takes a couple of mins to get into it when changes are to be made.

import { api } from '../parity';
import styles from './identityIcon.css';

export default class IdentityIcon extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use src/ui/IdentityIcon?

Copy link
Contributor Author

@jacogr jacogr Sep 26, 2016

Choose a reason for hiding this comment

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

Dapps should not rely on the ui/* stuff - we don't build those as a module and would make splitting of the apps from the repo problematic. However, there is probably something to say fro a dapps-ui thing that has all the common components. (e.g. for that IdentityIcon the same code is now in Gavcoin, TokenReg & here - that I know of)

So valid concern, just a different issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

* js:
  add type checking for methodToAbi
  remove shortcut for non-valid input to decodeCallData
@@ -16,6 +16,7 @@
*/

.method {
font-family: 'Roboto Mono' !important;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be font-family: …, monospace; to tell the computer that you want monospace event if loading the font fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was discussing it earlier today, really missing Sass variables, these things aren't very DRY. Should probably fix it all-over. Which brings me to the next point, fonts should be bundles as part of Webpack. (Tomasz did it somewhere in one of his apps, everything should be served with Parity, fast, no connection needed to play locally)

https://github.com/ethcore/parity/issues/2344


return {
value: `${ether.toFormat(5)}`,
token: <small>ΞTH</small>
Copy link
Contributor

Choose a reason for hiding this comment

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

being really picky – As of HTML5, <small> has a semantical meaning and should not be used for stylistic purposes. Use <span.

(also mentioned in https://github.com/ethcore/parity/pull/2099#discussion_r79003278)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. As commented there, we need a refactor of these completely - I picked up that habit from the Signer code. In addition, we actually are repeating these things everywhere (not just here), really not a good DRY approach.


.name,
.inputs {
font-family: 'Roboto Mono';
Copy link
Contributor

@derhuerst derhuerst Sep 26, 2016

Choose a reason for hiding this comment

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

Should be font-family: …, monospace; to tell the computer that you want monospace event if loading the font fails.

(from ethcore/parity@ff6a1fc#r80468994)

padding: 1em;
color: #eee;
font-size: 0.75em;
font-family: 'Roboto Mono';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn 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.

Until we have the fonts included, then not an issue anymore. Won't fix.

@jacogr jacogr removed the A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. label Sep 27, 2016
@jacogr jacogr merged commit 13903b8 into js Sep 27, 2016
@jacogr jacogr deleted the jg-dapp-signaturereg branch September 27, 2016 15:51
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.

3 participants